07 Oct 2015

feedAndroid Developers Blog

Keep users’ content safe with Google Drive

Posted by Dan McGrath, Product Manager, Drive SDK & Partnerships

Chances are, you're developing an app that creates or manages data. And chances are, your users really care about that content - be it photos and documents, or calorie counts and exercise stats.

Whatever it is, you probably don't want it stuck on a single device - especially since people are replacing their phones and tablets every couple of years (every now and then… shtuff happens). With Google Drive, you can help users access their data at any time, from just about anywhere:

As your app grows in popularity, Google Drive can scale along with it. In fact, WhatsApp now lets users back up their media and conversations to Google Drive, which translates to about one saved item for every person on the planet - every single day.

Visit our developer site to learn more, and definitely reach out if you want to discuss more in-depth integrations. We're here to help make your app great, and to keep users' content safe.

07 Oct 2015 6:07pm GMT

06 Oct 2015

feedAndroid Developers Blog

In-app translations in Android Marshmallow

Posted by, Barak Turovsky, Product Lead, Google Translate

Google Translate is used by more than 500 million people every month, translating more than 100 billion words every single day.

Beginning this week, Android mobile users who have the Translate app installed will be able to translate in 90 languages right within some of their favorite apps on any device running the newest version of Android's operating system (Android 6.0, Marshmallow).

Translating a TripAdvisor review from Portuguese
Composing a WhatsApp message in Russian

Android apps that use Android text selection behavior will already have this feature enabled, so no extra steps need to be taken. Developers who created custom text selection behavior for their apps can easily implement this feature by following the below steps:

Scan via the PackageManager through all packages that have the PROCESS_TEXT intent filter (for example: com.google.android.apps.translate - if it installed) and add them as MenuItems into TextView selections for your app

  1. To query the package manager, first build an intent with the action
    private Intent createProcessTextIntent() {
        return new Intent()
  2. Then retrieve the supported activities
    private List getSupportedActivities() {
        PackageManager packageManager =
  3. add an item for each retrieved activity and attach an intent to it to launch the action
    public void onInitializeMenu(Menu menu) {
        // Start with a menu Item order value that is high enough
        // so that your "PROCESS_TEXT" menu items appear after the
        // standard selection menu items like Cut, Copy, Paste.
        int menuItemOrder = 100;
        for (ResolveInfo resolveInfo : getSupportedActivities()) {
            menu.add(Menu.NONE, Menu.NONE,

The label for each item can be retrieved with:


The intent for each item can be created reusing the filter intent that you defined before and adding the missing data:

private Intent createProcessTextIntentForResolveInfo(ResolveInfo info) {
    return createProcessTextIntent()
            .putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, !

Adding the translation option to your apps text selection menu (if you don't use default Android text selection behavior) is easy and takes just a few extra lines of code. And remember, when a user is composing a text to translate, your app you should keep the selection when the Translate app is triggered.

With this new feature, Android Translate app users users will be able to easily translate right from within participating apps. We will be adding more documentation and sample code on this feature in the upcoming weeks.

06 Oct 2015 4:36pm GMT

05 Oct 2015

feedAndroid Developers Blog

Inside Android’s Easter Egg Tradition

Posted by, Natalie Hammel, ½ of Nat & Lo's 20% Project

A bit more than five years ago, I got my first smartphone. It was the Nexus One. And I didn't know it at the time, but it was hiding a zombie gingerbread painting inside it. The first (of now many) Android "platform" easter eggs.

Android actually has a long, rich history of various mysterious and silly things tucked away inside its code for developers to enjoy. But its "platform" or "version number" easter eggs are probably the most elaborate and well-known.

Earlier this summer, my friend at work Lo and I started this project to go find out about different Google stuff we're curious about. And one of the things we wanted to know more about was how the Android lawn sculptures get made. Which lead to us also finding out about why Android names its releases after tasty treats, and making this video.

As we were digging deeper into Android traditions, I decided to head up to Cambridge to get the inside scoop about Android's easter eggs tradition from Android Framework Engineer / Easter Egg Painter, Dan Sandler. Which we just made this video about.

We hope you enjoyed, and maybe discovered a thing or two. And if you're still in the mood for more Android video fun, the Android Developers YouTube channel was kind enough to recently compile all of our Android and Nexus videos to date in this playlist. (Take a look if you enjoy phone guts, silly songs, and/or stuffing your face with marshmallows.)

And since our project is ongoing, you can always subscribe to our YouTube channel if you want to check out what new stuff we'll be learning about next.

Thanks for reading, watching, and easter-egging with us!

05 Oct 2015 3:15pm GMT