21 December 2016

Introducing the ExifInterface Support Library

With the release of the 25.1.0 Support Library, there's a new entry in the family: the ExifInterface Support Library. With significant improvements introduced in Android 7.1 to the framework's ExifInterface, it only made sense to make those available to all API 9+ devices via the Support Library's ExifInterface.

The basics are still the same: the ability to read and write Exif tags embedded within image files: now with 140 different attributes (almost 100 of them new to Android 7.1/this Support Library!) including information about the camera itself, the camera settings, orientation, and GPS coordinates.

Camera Apps: Writing Exif Attributes

For Camera apps, the writing is probably the most important - writing attributes is still limited to JPEG image files. Now, normally you wouldn't need to use this during the actual camera capturing itself - you'd instead be calling the Camera2 API CaptureRequest.Builder.set() with JPEG_ORIENTATION, JPEG_GPS_LOCATION or the equivalents in the Camera1 Camera.Parameters. However, using ExifInterface allows you to make changes to the file after the fact (say, removing the location information on the user's request).

Reading Exif Attributes

For the rest of us though, reading those attributes is going to be our bread-and-butter; this is where we see the biggest improvements.

Firstly, you can read Exif data from JPEG and raw images (specifically, DNG, CR2, NEF, NRW, ARW, RW2, ORF, PEF, SRW and RAF files). Under the hood, this was a major restructuring, removing all native dependencies and building an extensive test suite to ensure that everything actually works.

For apps that receive images from other apps with a content:// URI (such as those sent by apps that target API 24 or higher), ExifInterface now works directly off of an InputStream; this allows you to easily extract Exif information directly out of content:// URIs you receive without having to create a temporary file.

Uri uri; // the URI you've received from the other app
InputStream in;
try {
  in = getContentResolver().openInputStream(uri);
  ExifInterface exifInterface = new ExifInterface(in);
  // Now you can extract any Exif tag you want
  // Assuming the image is a JPEG or supported raw format
} catch (IOException e) {
  // Handle any errors
} finally {
  if (in != null) {
    try {
      in.close();
    } catch (IOException ignored) {}
  }
}

Note: ExifInterface will not work with remote InputStreams, such as those returned from a HttpURLConnection. It is strongly recommended to only use them with content:// or file:// URIs.

For most attributes, you'd simply use the getAttributeInt(), getAttributeDouble(), or getAttribute() (for Strings) methods as appropriate.

One of the most important attributes when it comes to displaying images is the image orientation, stored in the aptly-named TAG_ORIENTATION, which returns one of the ORIENTATION_ constants. To convert this to a rotation angle, you can post-process the value.

int rotation = 0;
int orientation = exifInterface.getAttributeInt(
    ExifInterface.TAG_ORIENTATION,
    ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
  case ExifInterface.ORIENTATION_ROTATE_90:
    rotation = 90;
    break;
  case ExifInterface.ORIENTATION_ROTATE_180:
    rotation = 180;
    break;
  case ExifInterface.ORIENTATION_ROTATE_270:
    rotation = 270;
    break;
}

There are some helper methods to extract values from specific Exif tags. For location data, the getLatLong() method gives you the latitude and longitude as floats and getAltitude() will give you the altitude in meters. Some images also embed a small thumbnail. You can check for its existence with hasThumbnail() and then extract the byte[] representation of the thumbnail with getThumbnail() - perfect to pass to BitmapFactory.decodeByteArray().

Working with Exif: Everything is optional

One thing that is important to understand with Exif data is that there are no required tags: each and every tag is optional - some services even specifically strip Exif data. Therefore throughout your code, you should always handle cases where there is no Exif data, either due to no data for a specific attribute or an image format that doesn't support Exif data at all (say, the ubiquitous PNGs or WebP images).

Add the ExifInterface Support Library to your project with the following dependency:

compile "com.android.support:exifinterface:25.1.0"

But when an Exif attribute is exactly what you need to prevent a mis-rotated image in your app, the ExifInterface Support Library is just what you need to #BuildBetterApps

20 December 2016

Get the guide to finding success in new markets on Google Play

Posted by Lily Sheringham, Developer Marketing at Google Play

With just a few clicks, you can publish an app to Google Play and access a global audience of more than 1 billion 30 days active users. Finding success in global markets means considering how each market differs, planning for high quality localization, and tailoring your activity to the local audience. The new Going Global Playbook provides best practices and tips, with advice from developers who've successfully gone global.

This guide includes advice to help you plan your approach to going global, prepare your app for new markets, take your app to market, and also include data and insights for key countries and other useful resources.

This ebook joins others that we've recently published including The Building for Billions Playbook and The News Publisher Playbook. All of our ebooks are promoted in the Playbook for Developers app, which is where you can stay up to date with all the news and best practices you need to find success on Google Play.


How useful did you find this blogpost?

Start building Actions on Google

Posted by Jason Douglas, PM Director for Actions on Google

The Google Assistant brings together all of the technology and smarts we've been building for years, from the Knowledge Graph to Natural Language Processing. To be a truly successful Assistant, it should be able to connect users across the apps and services in their lives. This makes enabling an ecosystem where developers can bring diverse and unique services to users through the Google Assistant really important.

In October, we previewed Actions on Google, the developer platform for the Google Assistant. Actions on Google further enhances the Assistant user experience by enabling you to bring your services to the Assistant. Starting today, you can build Conversation Actions for Google Home and request to become an early access partner for upcoming platform features.

Conversation Actions for Google Home

Conversation Actions let you engage your users to deliver information, services, and assistance. And the best part? It really is a conversation -- users won't need to enable a skill or install an app, they can just ask to talk to your action. For now, we've provided two developer samples of what's possible, just say "Ok Google, talk to Number Genie " or try "Ok Google, talk to Eliza' for the classic 1960s AI exercise.

You can get started today by visiting the Actions on Google website for developers. To help create a smooth, straightforward development experience, we worked with a number of development partners, including conversational interaction development tools API.AI and Gupshup, analytics tools DashBot and VoiceLabs and consulting companies such as Assist, Notify.IO, Witlingo and Spoken Layer. We also created a collection of samples and voice user interface (VUI) resources or you can check out the integrations from our early access partners as they roll out over the coming weeks.

Introduction to Conversation Actions by Wayne Piekarski

Coming soon: Actions for Pixel and Allo + Support for Purchases and Bookings

Today is just the start, and we're excited to see what you build for the Google Assistant. We'll continue to add more platform capabilities over time, including the ability to make your integrations available across the various Assistant surfaces like Pixel phones and Google Allo. We'll also enable support for purchases and bookings as well as deeper Assistant integrations across verticals. Developers who are interested in creating actions using these upcoming features should register for our early access partner program and help shape the future of the platform.

Build, explore and let us know what you think about Actions on Google! And to say in the loop, be sure to sign up for our newsletter, join our Google+ community, and use the “actions-on-google” tag on StackOverflow.

19 December 2016

Best practices to improve app engagement

Posted by Niko Schröer, Business Development, Google Play

Driving installs is important to growing a user base, but it's not much use if your app sits on users' devices and is rarely opened. In a competitive app landscape, it's increasingly important to engage and retain users over the long term to build a successful business. Users who are using your app more will have a higher lifetime value and be more likely to share your app. Watch my Playtime session below to hear about the tools and features other developers are using to increase app engagement. You can also read the summary of my main tips below.

1. Build a high quality app to engage Android users

Building a high quality app is the foundation of a great user experience on Android. The better your app's user experience is, the more engaged your users will be. Optimizing for material design, for example, can significantly improve user engagement as well as building for Android Wear, Auto or TV where it makes sense based on your value proposition.

To achieve high quality, we recommend you to check out the latest Android features, tips, and best practices in our Playbook for Developers.

The developer of the golf app, Hole19, tailored their app's user experience thoughtfully for Android Wear and, as a result, saw a 40% increase in user engagement compared to non-Wear users. Watch a video about Hole19's success.

2. Make your users feel at home

Personalising your app experience to make users feel at home is a good way to start a long lasting relationship. Onboarding new users is a crucial step in this process. Onboarding should be fast and seamless and ask for minimal user input - after all users want to start using your app as quickly as possible. Furthermore, the onboarding should be a core part of the overall product experience. Use images and wording that's true to your brand and only ask for user input when it's actually needed, to reduce friction and avoid losing users.

Freeletics, a fitness app, created an engaging user onboarding flow in which they tailored imagery and text to male and female users respectively. They also moved the registration process to a later stage in the funnel to reduce friction. The improved onboarding flow increased user activity by 58% within the first 7 days. They also implemented Google Smart Lock to seamlessly sign-in returning users.

3. Optimize feature releases as a way to increase user engagement

Introducing new features is essential to staying ahead of competition and relevant to your users to ensure they keep coming back to your app. To make new feature launches successful drivers for user engagement, follow these simple steps:

  • Define a clear objective for each release to measure your impact, e.g. increase number of users who edit a photo by at least 10%.
  • Use beta testing to gather user feedback and iterate a feature before it's rolled out to all of your users.
  • Enable the pre-launch report in the Play developer console to spot potential flaws and ensure technical stability in your alpha and beta apps.
  • Guide users to each new feature as if it is a light onboarding experience. Visually highlight what's new and provide a short explanation why users should care.
  • Measure performance with analytics to see if the new feature drives engagement (that you've defined as your objective).

4. Use notifications wisely

Push notifications are a popular engagement tool and rightfully so. However, there is a fine line between driving engagement and annoying users (who might then uninstall your app). Follow these guidelines to ensure your notifications are on the right side of the line:

  • Be relevant and only send messages that matter to the user in context. Be creative and true to your brand, speak your users language and use an authentic tone.
  • Make notifications actionable for your users and don't forget to deep link to content where applicable to save your users time.
  • Remember that not all your users are equal so personalize your message to different user cohorts with Firebase Notifications.
  • Consider timeliness of your messages to get users the right notification at the right time and with the right frequency. For example, it might be better to send a notification about something interesting to read at a time when the user normally gets out their phone – like during their commute – instead of the middle of the day, when they might be busy and dismiss a new notification.
  • Finally, give users control over what notifications they receive so that they can opt-in and opt-out of the notifications they like and don't like respectively. If users get annoyed about certain types of notifications and don't have a way to disable them, they might uninstall your app.

The Norwegian news app Aftenposten implemented a new onboarding flow that clarified which notifications were available, allowing readers to manage their preferences. This reduced uninstalls by 9.2.% over 60 days and led to a 28% decrease in the number of users muting notifications completely. Read more about Aftenposten's success.

5. Reward your most engaged users

Last but not least, you should find ways to reward your most loyal users to retain them over time and to make it desirable to less engaged users to engage more. These rewards can come in many shapes and forms. Start by keeping it simple and make sure the reward adds real value to the user and fits in your app's ecosystem. You can do this by:

  • Giving sneak peeks of new features by inviting them to a beta group.
  • Decorating user accounts with badges based on their behaviour.
  • Offer app exclusive discounts or promo codes that can only be redeemed in your app.

Generally, the more you can personalize the reward the better it will work.

Find success with ongoing experimentation

A great Android app gives developers a unique opportunity to create a lasting relationship with users and build a sustainable business with happy customers. Therefore optimising apps to engage and retain your users by following these 5 tips should be front and centre of your development goals and company strategy. Find more tips and best practices by watching the sessions at this year's Playtime events.

How useful did you find this blogpost?



16 December 2016

Games authentication adopting Google Sign-In API

Posted by Clayton Wilkinson, Developer Platform Engineer

Some changes are coming to Play Game Services in early 2017:

Changes to Google API Client building

In November, we announced an update to Google Sign-In API. Play Game Services is being updated to use Google Sign-In API for authentication. The advantages are:

  • Games and Sign-In in same client connection.
  • Single API for getting Auth code to send to backend servers.

This change unifies the Google Sign-in and the Games API Sign-in, so there are updates to how to build the Google API Client:

// Defaults to Games Lite scope, no server component
  GoogleSignInOptions gso = new
     GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).build();

// OR for apps with a server component
   GoogleSignInOptions gso = new
     GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
         .requestServerAuthCode(SERVER_CLIENT_ID)
         .build();

// OR for developers who need real user Identity
  GoogleSignInOptions gso = new
     GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
         .requestEmail()
         .build();

// Build the api client.
     mApiClient = new GoogleApiClient.Builder(this)
                .addApi(Games.API)
                .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
                .addConnectionCallbacks(this)
                .build();
    }

 @Override
    public void onConnected(Bundle connectionHint) {
        if (mApiClient.hasConnectedApi(Games.API)) {
            Auth.GoogleSignInApi.silentSignIn(mApiClient).setResultCallback(
                   new ResultCallback() {
                       @Override
                       public void onResult(GoogleSignInResult googleSignInResult) {
                           // In this case, we are sure the result is a success.
                           GoogleSignInAccount acct = 
                              googleSignInResult.getGoogleSignInAccount());
 
                          // For Games with a server, send the auth code to your server.
                          String serverAuthCode = signInAccount.getServerAuthCode();
 
                         // Use the API client as normal.
                        Player player = Games.API.getCurrentPlayer(mApiClient);
                       }
                   }
            );
        } else {
            onSignedOut();
        }
    }

Account creation within iOS is no longer supported

  • Currently, there is no support for new players to create a Play Games account on iOS. Additionally, the Google+ integration has been removed from iOS. As a result "social" APIs will return result codes indicating success, but return empty lists. This includes the "standard" UIs for leaderboards and multiplayer invitations.

Google+ is no longer integrated

  • Announced last year, Games is decoupled from Google+ during this transition. As a result the public APIs for getting connected players via circles stopped working, but the standard UIs for multiplayer invitations and social leaderboards continued to work. Starting from February 2017, the standard UIs will also not display the Social graph results as Google+ data becomes inaccessible. This will affect multiplayer games, social leaderboards, and gifts API on Android. The effect will be that these APIs will return successfully, but with an empty list of players.

List of APIs that are deprecated by removing Google+ integration (and their C++ equivalents):

  1. Games.Players.getPlayerSearchIntent()
  2. Games.Players.loadConnectedPlayers()
  3. Games.Players.loadInvitablePlayers()
  4. The value LeaderboardVariant.COLLECTION_SOCIAL
  5. Invitations.loadInvitations()
  6. RealtimeMultiplayer.getSelectOpponentsIntent()
  7. TurnBasedMultiplayer.getSelectOpponentsIntent()
  8. All methods in the Requests package.

We realize this is a large change, but moving forward Play Game Services are much better aligned with the rest of the Mobile platform from Google and will lead to better developer experience for Android game developers.

Four tips for startup success from a Silicon Valley VC

Posted by Kacey Fahey, Marketing Programs Manager, Google Play

Working at Google Play, we’re on the front line watching developers build, polish, and launch their dreams for millions of users to experience. While it’s exciting to be a part of so much creativity, we’re often asked how small startups can stand out in such a competitive field. We recently had Josh Elman & Sarah Tavel of Greylock Partners speak at our events, sharing their experiences working in Product Marketing and Engineering at major tech companies including Twitter, Facebook and Pinterest. Below are four tips to hit the ground running and create a business built for success.

Set goals, both large and small


Every startup has an ultimate goal, but don’t forget to create micro-goals. Breaking your larger goal down into smaller milestones creates checkpoints to review progress and ensure momentum is heading in the right direction. This also allows for flexibility if teams need to course correct along the way, not to mention micro-accomplishments to celebrate!

Create stickiness


The first level in Sarah’s Hierarchy of Engagement is to identify the core action for users to perform in your app. Once you have engagement with this core action, level 2 is driving retention, getting users to come back and perform the core action more and more. The ultimate goal is to hook users with your app creating accruing benefits, whereby deeper and more frequent engagement creates habits and product dependencies.




“As companies move up the hierarchy, their products become better, harder to leave, and ultimately create virtuous loops that make the product self-perpetuating,” – Sarah Tavel, Partner at Greylock

Example: For those looking to improve on organizational skills, Evernote can be a lifesaver. The more lists users create, the more they rely on the product. Evernote becomes such an ingrained habit that it naturally transcends between personal and professional worlds.


Drive virality


When launching a new app, look for ways to achieve virality. Find hooks to make users fall in love with your app and strive to make it part of their regular habits. But watch out, not all types of virality are treated equally.

“Whenever you’re thinking about engineering virality, you need to be sure that you’re reaching the right people, getting them interested for reasons that align with the intrinsic value of your product, and leading them to the right actions,” – Josh Elman, Partner at Greylock Example: Whether you’re lucky enough to convert happy users into product evangelists or catch fire through social media, outbreak virality has driven tremendous success for apps like Pokémon GO and Prisma.

Measure cohorts


While monitoring traditional mobile metrics such as installs and DAUs provide a high level overview of app performance, cohort analysis is key to understanding user behavior and optimizing for growth. When rolling out changes in your app, make sure to track cohorts for an extended duration. Initial results may tell one story at D7, but hold tight, as things could turn a corner by D15 or even later. Give users time to adapt and get comfortable with the changes before making any final product decisions.

Read more tips on how to find success for your app or game start up in the Playbook for Developers app.

How useful did you find this blogpost?



15 December 2016

Get a glimpse of Wear 2.0’s upcoming standalone apps

Kacey Fahey, Marketing Programs Manager, Google Play

The upcoming Android Wear 2.0 experience will introduce standalone apps, expanding your potential reach to both Android and iOS audiences with Wear devices. Users will be able to search, install, and use apps without ever leaving their device. See how other developers are enhancing their user experience with standalone apps for messaging, travel & local, and health & fitness.

Glide

Having a watch app further simplifies video messaging with Glide. Using the Wear Complications API, Glide is now able to live broadcast directly from the watch face. By tapping contact shortcuts from the watch face, you can now launch directly into a conversation. This experience brings speed and intimacy to the world of messaging, making wrist-based communication more accessible and effortless.

Foursquare

Travelers around the world use Foursquare's Android Wear app to discover hidden gems and be in the know about the best places to eat, drink and explore. With their upcoming 2.0 app, the team has a clean new canvas for rich notifications giving users an immersive experience with Foursquare content.

"The standalone nature of the Android Wear 2.0 app will offer a big boost in search performance and app responsiveness so you spend less time staring at the screen and more time exploring the world around you," said Kyle Fowler, Software Engineer at Foursquare.

Lifesum

Lifesum helps users make better food choices, improve their exercise, and reach health goals. The upcoming 2.0 experience complements the existing Lifesum mobile app and as a standalone app, it will allow users to more easily track water and meals throughout the day.

"It's all about increasing access and being there for the user in a quick and simple way. We believe a simplified way of tracking meals and water will make it easier for our users on their journey of becoming healthier and happier," said Joakim Hammer, Android Developer at Lifesum


Check out g.co/wearpreview for the latest builds and documentation about the recently released Android Wear Developer Preview 4.
How useful did you find this blogpost?