The Wayback Machine - https://web.archive.org/web/20141111031341/http://android-developers.blogspot.com/

10 November 2014

Utilities for C/C++ Android Developers: fplutil 1.0

By Stewart Miles, Fun Propulsion Labs at Google*

Today we're announcing the 1.0 release of fplutil, a set of small libraries and tools by Fun Propulsion Labs at Google (the FPL in fplutil) that is useful when developing C/C++ applications for Android.

fplutil introduces the following:

  • build_all_android.py, an all-in-one build script that allows you to build (with the Android NDK), install and run native (C/C++) Android apps from the command line. This is ideal for build automation, but is also useful in a developer’s compile/run loop.
  • buildutil performs the configuration, build and archive steps of Android and Linux C/C++ applications using a suite of Python modules. This suite of modules can automate builds in a continuous integration environment. This framework uses legacy tools in the Android Development Toolkit.
  • libfplutil enables C/C++ developers to write traditional applications (like Hello World) using "main()" and "printf()" on Android.
  • android_ndk_perf.py is a desktop tool that enables native (C/C++) developers to measure the CPU utilization of their applications on Android, guiding their optimization efforts. An example report is shown below:

android_ndk_perf.py example HTML report

You can download the latest open source release from our github page. We invite you to contribute to the project and join our discussion list!

*Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.

06 November 2014

Improved Game Testing with Google Play Games Management API

By Ben Frenkel, Google Play Games team

We’re always looking to help developers improve the gaming experience for their users on Google Play. So today, we've expanded our existing suite of Management APIs to let you fully control all resources in your Google Play Games-enabled game during development and testing, with better support for alpha and beta groups.

Let’s take a quick dive into the expanded offering.

  • Reset a single tester’s state for any resource (e.g., achievements, leaderboards), or do it for all resources at once. For example, you can now completely reset a given tester’s data if they’ve ended up in a bad state due to an experimental build. You can do this for individual instances or all instances of achievements, events, quests, or leaderboards scores.
  • Reset the state of a single draft resource for all testers, or do it for all draft resources at once. You can now reset all draft leaderboards in your game before publishing with a single API call. This ensures the members of your alpha or beta communities don’t have an unfair advantage on release day. You can do this for individual instances or all instances of achievements, events, quests, or leaderboards scores.
  • Clear global match state for all real time or turn based matches composed solely of testers. You can now reset all turn-based matches on release day. This will ensure that all matches from that point on are on the release version of the game. This is available for both real-time or turn-based games.

These updates make it far less complex and error prone to manage data during testing, saving you time and improving the rate at which you can make and test changes to your games.

Play Games Management API background

The Management API is a set of tools that enable developers to do things like manage tester data and clean up bogus leaderboard score submissions. Developers can also use the API to control and manipulate resources (e.g., achievements, events, multiplayer match data).

Getting started

You can get started with the latest version of the Management API right now. Review the updated API reference documentation, start with an example management interface, or download the sample client libraries to get on your way.

Introducing a New Guide, “The Secrets to App Success on Google Play”

By Dom Elliott, Google Play team

With more than 50 billion apps and games downloaded in total, Google Play is helping developers and content creators around the world build successful businesses. In fact, we paid out more than $5 billion over the last year to developers for creating incredible apps that are changing the way people communicate, live, work, and play.

Developing an app or game and distributing it on Google Play is a good start, but it’s only the first step to building a sustainable business. That’s why we’ve written “The Secrets to App Success on Google Play,” a detailed playbook on the best practices and tools you can use to maximize the reach, retention, and revenue of your new app.

The guide is separated into the following sections:

  • Publishing on Google Play — using the Google Play Developer Console to distribute your app to over 1 billion Android users worldwide.
  • Quality — The fundamentals of building a great app and an insight into the Google Play guidelines and policies.
  • Discoverability & reach — Maximizing your app's discoverability and reaching the widest audience possible.
  • Engagement & retention — Converting installations into active users and improving user retention.
  • Monetization — Monetization strategies to generate ongoing, growing revenue streams.
  • Measurement with Google Analytics — Understanding your users and improving your app experience, conversions, and marketing.
  • Going global — Launching your app in local markets around the world.

Download the guide now in English (PDF, 11MB) or get it on Google Play. We’ll release the guide in more languages in the coming months. If you’re in the US or the UK, we also have a limited number of printed copies that we are offering to send for free. Request a printed copy here.

Once you’ve checked out the guide, we’d love to hear your feedback so we can continue to improve, let us know what you think.

05 November 2014

Going Global: Space Ape Games Finds Success in Japan

By Leticia Lago, Google Play team

There are many ways to find success for a game on the international stage: it’s not a simple formula, it’s a combination of things, ranging from localizing effectively to choosing the right price. London-based Space Ape Games brought together a range of resources and tactics to take Samurai Siege into Japan, growing that market to contribute up to 15% of the game’s average $55,000 daily earnings.

John Earner, Simon Hade, and Toby Moore founded Space Ape Games in 2012 with just 12 people. Their goal, to create amazing multiplayer mobile games. Samurai Siege is their first game and they found that Android players have great retention and monetize well. “Our experience has been great with Google Play. We have found that it is half of our audience and half of our business,” says John.

Check out the video below to hear more about how Space Ape expanded to Japan.


Resources to help you grow globally

You can grow your games business worldwide too, and maximize your distribution potential with Google Play. Be sure to check out these resources:

  • Reaching players in new territories panel [VIDEO] — Hear first hand experiences from game developers who have successfully taken games to international markets. Antonin Lhuillier (Gameloft), Anatoly Ropotov (Game Insight), Saad Choudri (Miniclip), Eyal Rabinovich (Playscape), and Joe Raeburn (Space Ape Games) share their tips for localization, culturalization, and more.
  • Go Global session [VIDEO] — Hyunse Chang, from the Google Play Apps and Games team in Korea, shares key insights into APAC markets and trends among successful apps and games in the region. Leverage these pro tips and best practices to expand your reach to a wider audience.
  • Localization checklist — This document identifies the essential aspects of localization, to help you get your app ready for a successful worldwide launch on Google Play.

03 November 2014

Your Chance to be on TV!

By Tarjei Vassbotn and Dan Galpin, Developer Advocates, Android TV

We’re excited to see the launch of Nexus Player, the first consumer streaming media player running Android TV. Android TV delivers an entertainment experience tailored for users, including movies, shows, games and more.
Now is a great time to develop apps for Android TV that reach a whole new audience.

Starting today, you can publish your apps for Android TV on Google Play, the largest digital store for apps and games. We’ve provided guidance on how to get started building great apps for Android TV in this post.

"Google has done an insanely good job to ease the developer’s task of creating a TV application, mainly thanks to the Leanback support library. It literally takes 2 hours to create a fully working and possibly fancy app, which is awesome."

- Sebastiano Gottardo

A high bar for quality experiences

We want to offer the best possible experience for users to enjoy your apps and games. To make this possible, your Android TV app must meet the basic requirements for usability. When your app meets these requirements, users will be able to discover and download it directly on their Android TV devices.

Even if you have already uploaded your app to the Google Play Developer Console, you will need to add TV graphics and screenshots, and opt-in to distribution on TV on the Pricing & Distribution page. For complete information about the requirements and process of publishing your Android TV app for Google Play, make sure to check out the publishing documentation.

Get started!

With our Leanback Library we’ve made it easy for you to extend your existing app to the TV screen or even build a completely new app for Android TV. For a quick look at the Leanback Library, check out this DevBytes video.

We’ve only begun scratching the surface of what’s possible with this new form factor, and we are very excited to see what you will build, start developing today!

29 October 2014

The fastest route between voice search and your app

By Jarek Wilkiewicz, Developer Advocate, Google Search

How many lines of code will it take to let your users say Ok Google, and search for something in your app? Hardly any. Starting today, all you need is a small addition to your AndroidManifest.xml in order to connect the Google Now SEARCH_ACTION with your searchable activity:

<activity android:name=".SearchableActivity">
    <intent-filter>
        <action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
</activity>

Once you make these changes, your app can receive the SEARCH_ACTION intent containing the SearchManager.QUERY extra with the search expression.

At Google, we always look for innovative ways to help you improve mobile search and drive user engagement back to your app. For example, users can now say to the Google app: “Ok Google, search pizza on Eat24” or “Ok Google, search for hotels in Maui on TripAdvisor.”

This feature is available on English locale Android devices running Jelly Bean and above with the Google app v3.5 or greater. Last but not least, users can enable the Ok Google hot-word detection from any screen, which offers them the fastest route between their search command and your app!

28 October 2014

Tips for integrating with Google Accounts on Android

By Laurence Moroney, Developer Advocate

Happy Tuesday! We've had a few questions come in recently regarding Google Accounts on Android, so we've put this post together to show you some of our best practices. The tips today will focus on Android-based authentication, which is easily achieved through the integration of Google Play services. Let's get started.

Unique Identifiers

A common confusion happens when developers use the account name (a.k.a. email address) as the primary key to a Google Account. For instance, when using GoogleApiClient to sign in a user, a developer might use the following code inside of the onConnected callback for a registered GoogleApiClient.ConnectedCallbacks listener:

[Error prone pseudocode]
String accountName = Plus.AccountApi.getAccountName(mGoogleApiClient);
// createLocalAccount() is specific to the app's local storage strategy.
createLocalAccount(accountName);

While it is OK to store the email address for display or caching purposes, it is possible for users to change the primary email address on a Google Account. This can happen with various types of accounts, but these changes happen most often with Google Apps For Work accounts.

So what's a developer to do? Use the Google Account ID (as opposed to the Account name) to key any data for your app that is associated to a Google Account. For most apps, this simply means storing the Account ID and comparing the value each time the onConnected callback is invoked to ensure the data locally matches the currently logged in user. The API provides methods that allow you to get the Account ID from the Account Name. Here is an example snippet you might use:

[Google Play Services 6.1+]
String accountName = Plus.AccountApi.getAccountName(mGoogleApiClient);
String accountID = GoogleAuthUtil.getAccountId(accountName);
createLocalAccount(accountID);
[Earlier Versions of Google Play Services (please upgrade your client)]
Person currentUser = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
String accountID = currentUser.getID();
createLocalAccount(accountID);

This will key the local data against a Google Account ID, which is unique and stable for the user even after changing an email address.

So, in the above scenario, if your data was keyed on an ID, you wouldn’t have to worry if your users change their email address. When they sign back in, they’ll still get the same ID, and you won’t need to do anything with your data.

Multiple Accounts

If your app supports multiple account connections simultaneously (like the Gmail user interface shown below), you are calling setAccountName on the GoogleApiClient.Builder when constructing GoogleApiClients. This requires you to store the account name as well as the Google Account ID within your app. However, the account name you’ve stored will be different if the user changes their primary email address. The easiest way to deal with this is to prompt the user to re-login. Then, update the account name when onConnected is called after login. Any time a login occurs you, can use code such as this to compare Account IDs and update the email address stored locally for the Account ID.

[Google Play Services 6.1+]
String accountName = Plus.AccountApi.getAccountName(mGoogleApiClient);
String accountID = GoogleAuthUtil.getAccountId(accountName);
// isExistingLocalAccount(), createLocalAccount(), 
// getLocalDataAccountName(), and updateLocalAccountName() 
// are all specific to the app's local storage strategy.
boolean existingLocalAccountData = isExistingLocalAccount(accountID);
if (!existingLocalAccountData) {
    // New Login.
    createLocalAccount(accountID, accountName);
} else {
    // Existing local data for this Google Account.
    String cachedAccountName = getLocalDataAccountName(accountID);    
    if (!cachedAccountName.equals(accountName)) {
        updateLocalAccountName(accountID, accountName);
    }
}

This scenario reinforces the importance of using the Account ID to store data all data in your app.

Online data

The same best practices above apply to storing data for Google Accounts in web servers for your app. If you are storing data on your servers in this manner and treating the email address as the primary key:

ID [Primary Key] Field 1 Field 2 Field 3
user1@gmail.com Value 1 Value 2 Value 3

You need to migrate to this model where the primary key is the Google Account ID.:

ID [Primary Key] Email Field 1 Field 2 Field 3
108759069548186989918 user1@gmail.com Value 1 Value 2 Value 3

If you don't make Google API calls from your web server, you might be able to depend on the Android application to notify your web server of changes to the primary email address when implementing the updateLocalAccountName method referenced in the multiple accounts sample code above. If you make Google API calls from your web server, you likely implemented it using the Cross-client authentication and can detect changes via the OAuth2 client libraries or REST endpoints on your server as well.

Conclusion

When using Google Account authentication for your app, it’s definitely a best practice to use the account ID, as opposed to the account name to distinguish data for the user. In this post, we saw three scenarios where you may need to make changes to make your apps more robust. With the growing adoption of Google for Work, users who are changing their email address, but keeping the same account ID, may occur more frequently, so we encourage all developers to make plans to update their code as soon as possible.