Category Archives: Android Developers Blog

An Open Handset Alliance Project

Meet 5 Android developers working to improve lives around the world

Posted by Maxim Mai, Apps Partnerships, Google Play

Last Thursday at Google I/O 2017, we announced the winners of this year's Google Play Awards. Grab some popcorn and watch the award ceremony, we think it's just as fun as The Oscars. This year, we included a category to celebrate the achievements of developers who publish outstanding apps that have positive social impact.

In introducing this awards category, we were inspired by the UN's 17 Sustainable Development Goals. With the ability to reach over 1 billion active Android devices around the world, we think that app developers have a tremendous opportunity to impact Zero Hunger (SDG #2), Good Health and Wellbeing (SDG #3) and Quality Education (SDG #4), and many others. Read on to find out more about how this year's winner and finalists and impacting these goals.

Get in touch about your social impact app or game

Our work in supporting developer success in this area on Android and Google Play is just beginning. We would like to encourage Android developers with a focus on social impact to get in touch with us here at Google Play and to tell us about their app or game. It doesn't matter where you are based, what problems you are solving, or which countries you are targeting, we would like to hear your story and maybe we can help you grow faster and improve your app's quality.

Social impact winner & finalists in the 2017 Google Play Awards

🏆 ShareTheMeal by United Nations 🏆

The Google Play Award category winner, ShareTheMeal, generates large scale, global awareness for "Zero Hunger" and its users' donations pay for school meals, which are provided by the World Food Programme, in regions around the world experiencing food insecurity. Over 13 million meals have been donated via the app since launch!

Charity Miles by Charity Miles

This is a running, cycling and walking tracker app with a social impact twist. Charity Miles earns money for charity on your behalf for every mile you move, via its brand fitness exercise sponsors! Users have already donated $2 million to charity by recording over 40 million miles!

Peek Acuity by Peak Vision

Peek Acuity allows anyone with an Android phone to easily measure visual acuity, which is one of the components of vision. It is designed by eye care professionals to be used to help identify people who need further examination by, for example, an optometrist or ophthalmologist. In developing countries, over XM [confirm number with Peek Vision] struggle with vision impairment and many don't have easy access to an eye care professional.

Prodeaf Translator by ProDeaf Tecnologias Assistivas

This app lets anyone translate phrases and words from Portuguese for Brazilian Sign Language (Libras) or from English to American Sign Language (ASL). This significantly reduces barriers to communication between the millions of people who depend on Libras or ASL as their lingua franca and others who have not had the opportunity to learn this form of communication.

Sea Hero Quest by GLITCHERS

This is not just a game, it's a quest to help scientists fight dementia! It sounds too good to be true but this really is a game, where simply by having loads of fun chasing creatures around magical seas and swamps, you can help to fight a disease that currently affects 45 million people worldwide. In fact playing SEA HERO QUEST for just 2 minutes will generate the equivalent of 5 hours of lab-based research data.

If you're working on an app or game with a positive social impact, don't forget to get in touch via this form and tick the "Social Impact app" checkbox.

How useful did you find this blogpost?

Welcome to your New Home on Android TV

Posted by Paul Saxman, Android Devices and Media Developer Relations Lead

Android TV brings rich app experiences and entertainment to the biggest screen in your house, and with Android O, we’re making it even easier for users to access content from their favorite apps. We’ve built a new, content-centric home screen experience for Android TV, and we're bringing the Google Assistant to the platform as well. These features put content that users want to access a few clicks, or spoken words, away.

The New Android TV Home Screen

The new Android TV home screen organizes video content into channels and programs in a way that’s familiar to TV viewers. Each Android TV app can publish multiple channels, which are represented as rows of programs on the home screen. Apps add relevant programs on each channel, and update these programs and channels as users access content or when new content is available. To help engage users, programs can include a video preview, which is automatically played when a user focuses on a program. Users can configure which channels they wish to see on the home screen, and the ordering of channels, so the themes and shows they’re interested in are quick and easy to access.

In addition to channels for you app, the top of the new Android TV home screen includes a quick launch bar for users' favorite apps, and a special Watch Next channel. This channel contains programs based on the viewing habits of the user.

The APIs for creating and maintaining channels and programs are part of the TvProvider APIs, which are distributed as an Android Support Library module with Android O. To get started using these APIs, visit the Android O Developer Preview site for an overview, and try out the Android TV Channels and Programs codelab for a first-hand experience building an Android TV app for Android O.

Later this year, Nexus Players will receive the new Android TV home experience as an OTA update. If you wish build and test apps for the new interface today, however, you can use the Android TV emulator or Nexus Player device images that are part of the latest Android O Developer Preview.

The Google Assistant on Android TV

The Google Assistant on Android TV, coming later this year, will allow users to quickly find and access content using their voice. Because the Assistant is context-aware, it can help users narrow down what content to play. Users will also be able access the Assistant to control playback, even while a video or music is playing. And since the Assistant can control compatible smart home devices, a simple voice request can dim the lights to create an ideal movie viewing environment. When the Google Assistant comes to Android TV, it will launch in the US on Android devices running M, N, and O.

We're looking forward to seeing how developers take advantage of the new Android TV home screen. We welcome feedback, so please visit the Android TV Developer Community on G+ to share you thoughts and ideas!

Request a professional app translation from the Google Play Console and reach new users

Posted by Rahim Nathwani, Product Manager, Google Play
Localizing your app or game is an important step in allowing you to reach the widest possible audience. It helps you increase downloads and provide better experiences for your audience.
To help do this, Google Play offers an app translation service. The service, by professional linguists, can translate app user interface strings, Play Store text, in-app products and universal app campaign ads. We've made the app translation service available directly from inside the Google Play Console, making it easy and quick to get started.
  • Choose from a selection of professional translation vendors.
  • Order, receive and apply translations, without leaving the Play Console.
  • Pay online with Google Wallet.
  • Translations from your previous orders (if any) are reused, so you never pay for the same translation twice. Great if you release new versions frequently.
Using the app translation service to translate a typical app and store description into one language may cost around US$50. (cost depends on the amount of text and languages).
Find out more and get started with the app translation service.

How useful did you find this blogpost?

Group Messaging in Android Auto

Posted by David Nelloms, Software Engineer
Communicating with a group of people is a common use case for many messaging apps. However, it may be difficult to know how the Android Auto messaging API applies to group conversations. Here are some tips for getting started with group messaging in Android Auto:

Conversation Name

When constructing the UnreadConversation builder, you are required to pass in a name. This is the name of the conversation that is displayed to the user when messages arrive.

UnreadConversation.Builder unreadConvBuilder =
    new UnreadConversation.Builder(conversationName)
        .setReadPendingIntent(msgHeardPendingIntent)
        .setReplyAction(msgReplyPendingIntent, remoteInput);

For one-on-one conversations, this is simply the name of the other participant. For group conversations, it is best to choose one of two options for the name:

  1. Conversation title: If your app supports adding a title to group conversations, use the title for the name parameter to be consistent with your in-app experience. This field is similar to NotificationCompat.MessagingStyle#setConversationTitle.
  2. A list of participants: Build a comma-separated list of participants for the name parameter to identify the group. Note that this is read aloud by the text-to-speech system, so you may need to abbreviate the list for large groups. You should balance allowing users to uniquely identify the group with the time taken to listen to messages.

Text to Speech Formatting

Getting text to sound natural using a TTS system is a challenging problem. There are teams working hard to improve this, but there are steps you can take to create a better user experience with the current capabilities. The Android Auto messaging API does not yet have an option for pairing participants with individual messages in a group conversation. This is problematic for drivers when there are multiple unread messages from multiple participants in a group conversation, as the drivers cannot see which group member sent which message. One solution is to prepend the sender's name to the message whenever the sender changes so that the names are read aloud to the driver.

CharSequence currentSender = null;
for (Message message : myMessages) {
    StringBuilder messageText = new StringBuilder();
    CharSequence sender = message.getSender();
    // Maybe append sender to indicate who is speaking.
    if (!TextUtils.isEmpty(sender) && !sender.equals(currentSender)) {
        if (currentSender != null) {
            // Punctuation will briefly pause TTS readout between senders.
            messageText.append(". ");
        }
        currentSender = sender;
        messageText.append(sender.toString().toLowerCase(Locale.getDefault()));
        // Punctuation will separate sender from message in TTS readout.
        messageText.append(": ");
    }
    messageText.append(message.getText());
    unreadConvBuilder.addMessage(messageText.toString());
}

Some things to note about the above sample code:

  • Adding punctuation is not strictly necessary, but it can produce a more natural sounding result.
  • The sender names are converted to lowercase. This is workaround for a quirk where the TTS implementation vocalizes ". " as "dot" when preceding a capital letter on some devices.

Get participants

In searching for how to handle group messaging, you may have noticed UnreadConversation#getParticipants. This can be confusing as there is no mechanism to add multiple participants in the builder. The builder implementation populates the array with the conversation name passed to its constructor. Internally, Android Auto uses the singular UnreadConversation#getParticipant, which returns the first element of the participants array, to populate the title in the notification view.

Stay tuned

The Android Auto team is working on ways to make messaging with drivers simpler and more intuitive for app developers. Stay tuned for future updates so that you can continue to deliver a great user experience!

Make more money with subscriptions on Google Play

Posted by George Audi, Tom Grinsted and Larry Yang, Google Play

The subscription business model is one of the best ways to make more regular, reliable, and recurring revenue on Android and Google Play. In fact, both developers and users love subscription apps so much that we’ve seen a 10X growth in consumer spend over the past three years and double the number of active subscribers in the past year. Thousands of developers are offering subscriptions through Google Play and are already seeing success with our billing platform. That’s why we’ve been working hard to help you take advantage of this opportunity and give you greater insights into your business and Android users.

New features to help your subscriptions business thrive

You've got a high-performing product with fantastic features and compelling content, but your business can't succeed without acquiring new users. In addition to free trials, intro pricing, flexible billing periods, and more, we recently launched the ability to pay for subscriptions with Google Play balance. Although people have already been using gift cards to pay for Play content in over 20 countries, the use of gift cards to pay for subscriptions in regions where cash is a popular form of payment, such as Latin America, has resulted in as high as a 15% increase in subscription spend.

But it's not just about acquiring new customers, it's about retaining the ones you have. That's why we are introducing account hold, where we work with you to block access to your content or service if a user's form of payment fails. This directly links a payment failure to the user losing access to your content and/or premium features, which is enough to get them to go and choose a new form of payment. When Keepsafe–the developer of Keepsafe Photo Vault, a photo locker for private pictures and videos with over 50M downloads–integrated account hold, their renewal rate on Android increased by 25%. We have over a dozen developers in early access today, and we will be announcing public availability at the end of June.

We know data is vital to running your business, so we're excited to announce a new subscriptions dashboard in the Play Console, and a new report on Android app subscribers.

The dashboard brings together subscription data like new subscribers, cancellations, and total subscribers. It also displays daily and 30-day rolling revenue data, and highlights your top-performing products. This will give visibility into your subscription products and users and will help guide your business decisions.

Insights to help you grow your subscriptions business

In addition to products and features, understanding people's needs is core to building a successful subscription business. We talked to 2,000 Android app subscribers in the US and UK and asked them how and why they use the apps they do. The results shared in 'Subscription apps on Google Play: User insights to help developers win' report highlight some of the opportunities for you to grow your subscriptions user base, set pricing strategies and learn to keep your users engaged, including:

  • Use free trials to acquire users. 78% of users start with a free version of an app, and many cite a discount or end of a free trial as a reason to pay.
  • Keep your content appealing and updated to get and keep users paying. It's the most important driver in converting users from free to paid users, as well as keeping users engaged and retained.
  • There is a huge opportunity to make money from subscriptions. While pricing elasticity varies by category, few users cite price as a reason to churn from a paid subscription and 64% either budget on a per app basis or not at all (as opposed to budgeting across all app subscriptions).
To find out more about your growing your subscription business with Google Play, watch our I/O session, download the research report (PDF), and get started with subscriptions with Google Play In-app Billing.

How useful did you find this blogpost?

Android Wear: New complications tools and watch friendly UI library

Posted by Hoi Lam, Lead Developer Advocate, Android Wear
Android Wear 2.0 gives users more informative watch faces and provides developers with new ways to build useful apps. These new opportunities have been well received by users and developers alike. To help developers take advantage of these new features, we have released a suite of complication API tools, to make it easier for developers to add complication support to their watch faces, and a new Wear UI library, to help developers build watch friendly user interfaces.

New Complications API tools for Watch Face developers

Complications are bite-sized pieces of information displayed directly on the watch face. They can also be great shortcuts into your favorite apps. We introduced the Complications API last year to enable watch faces to receive data from any app that the user selects, and display the data to the user in a way that is stylistically coherent. Today, we are introducing four new tools to make it easier for watch face developers to integrate with the Complications API:

  • TextRenderer - Auto-sizes text to fit in bounds defined by watch face makers.
  • ComplicationDrawable - A full rendering solution for complications, that handles all the styling for you, and adjusts the layout to fit the space you specify
  • Easy watch face settings sample - Adoptable sample code that makes it easier to build complication settings with a rich and usable experience.
  • Complication test suite - A sample data provider to help check that your watch face can handle all the combinations of fields that can make up complication data.

It's never been easier to integrate complications into your watch faces.

New Wear UI Library for Wear developers

We have provided Android view components for building watch friendly user interfaces since the launch of Android Wear 1.0. Developers have told us that they would like to see these components open sourced. So, starting at Google I/O, we are open sourcing some components and providing some Android Wear UI components in the Android Support Library. This brings a number of advantages, including more consistent APIs with the rest of the Support Library, more frequent releases, and better responsiveness to developer feedback. We will:

  • Migrate Wearable Support classes - Migrate and update Android Wear specific view components, such as WearableRecyclerView, from android.support.wearable.view in Wearable Support to android.support.wear.widget in the Android Support Library. This new package is available as open source. In terms of developer impact, we expect the migration process to be simple, with minor API name changes to bring consistency with the existing Android Support Library.
  • Merge some Android Wear functionality to Android - Some Android Wear components have a lot of overlap with Android, e.g. CircledImageView and DelayedConfirmationView. We will merge the Android Wear specific functionality with the Android counterparts under android.support.v4.widget.
  • Deprecate outdated user interface patterns - Two user interface patterns are deprecated with Android Wear 2.0: the Card pattern and the Multi-directional layout. As a result, we have deprecated all supporting classes, such as GridViewPager and CardFragment. Please refer to the class reference docs for their replacements.

In the first wave of these changes, we migrated the WearableRecyclerView, BoxInsetLayout and SwipeDismissFrameLayout classes to the new Android Wear UI Library. We expect the migration process to continue during 2017, and developers will have until mid-2018 to migrate to the new UI components. For additional information, see Using the Wear UI Library.

Get started and give us feedback!

To get started with these new tools, simply update the Android Support Library in Android Studio and update your gradle build files to import the new support libraries. In addition to the documentation links above, check out the Google I/O session - Android Wear UI development best practice - where lead engineers for these tools will be on-hand to explain the technical details.

We will continue to update these tools over the next few months, based on your feedback. The sooner we hear from you, the more we can include, so don't be shy! Let us do some of the heavy lifting for your Android Wear apps and watch faces.

What’s next for Google payment and loyalty experiences

Posted by Pali Bhat, VP of Payment Products

Thousands of apps and millions of stores accept Android Pay, a simpler and more secure mobile payment experience. Android Pay is now available in 10 markets, with more coming soon, including Brazil, Canada, Russia, Spain and Taiwan. And in addition to our already announced Visa and Mastercard partnerships, we'll soon enable a streamlined mobile checkout experience for PayPal users.

The newest ways to pay with Google

Yesterday, we announced the Google Payment API, which lets people pay in app or online with any verified credit or debit card saved to their Google Account, via products like Google Play, Chrome and YouTube.

Paying with Google in the Wish app

For users, the option to pay with Google means breezing through checkout without needing to remember and type multiple lines of payment details. You simply choose your preferred card, enter a security code or authenticate with your Android device, and check out.

Developers who adopt this API can enable an easy-to-use checkout experience for their customers. Sign up for early access to the new Google Payment API.

In the upcoming months, we'll also enable people in the U.S. to send or receive payments via the Google Assistant. On your Google Home or Android device, it's as simple as saying "Ok Google, send $10 to Jane for pizza." All you need is a debit card linked to your Google account.

Pay friends on Google Assistant

Connect with customers before, during and after purchase

We're also announcing new ways for merchants to engage and reward customers before they walk into the store and after they've left.

The Card Linked Offers API drives customer loyalty by providing a new channel to deliver targeted offers, and Panera Bread is one of the first merchants who will roll out this new capability nationally. MyPanera members who save their loyalty card to Android Pay can discover offers and learn about new menu items, surfaced by Android Pay when they are at the store. The offer is redeemed when you use your MyPanera account at checkout.

Card Linked Offers for Panera Bread in the Android Pay app

We're also making it easier for Android Pay users to add loyalty programs. For example, Walgreens Balance Rewards® members who manually apply their loyalty account with a phone number and use Android Pay will receive a notification on their phone that easily enables them to link that loyalty card to Android Pay for future visits. This experience is powered by our smart tap technology, which Walgreens has fully deployed across their 8,000+ U.S. stores.

There's more—we're collaborating with Clover, a First Data company, to expand our smart tap technology beyond national retailers to businesses of all sizes. With the upcoming integration of smart tap in Clover's developer APIs, you'll be able to build Android apps for loyalty, coupon and gift card redemption and new features, such as order ahead and tap for pick up.

Visit developers.google.com/payments for the latest on all of our Google Payment, Loyalty and Offers APIs.

Android and Architecture








Android and Architecture

The Android operating system provides a strong foundation for building apps that run well on a wide range of devices and form factors. That being said, we've listened to developer feedback; Issues like complex lifecycles and the lack of a recommended app architecture make it challenging to write robust apps.


 We need to make it easier—and more fun—to write robust apps, empowering developers to focus on areas where they can innovate. Today we're announcing a guide to Android app architecture along with a preview of Architecture Components. Rather than reinventing the wheel, we're also recognizing the work done by popular Android libraries.


Opinions not Prescriptions

We know that there's more than one way to write Android applications.  What we're providing is a set of guidelines that can help you architect an Android application to work best with the unique ways that Android interacts. The Android framework has well-defined APIs to handle contact points with the OS, such as Activities, but these are entry points into your application, not building blocks for your application architecture; Framework components don't force you to separate your data model from your UI components, or provide a clear way to persist data independent of the lifecycle.

Building Blocks

Android Architecture components work together to implement a sane app architecture, while they individually address developer pain points. The first set of these components helps you:

  • Automatically manage your activity and fragment lifecycles to avoid memory and resource leaks
  • Persist Java data objects to an SQLite database



Lifecycle Components

New lifecycle-aware components provide constructs to tie core components of your applications to lifecycle events, removing explicit dependency paths.

A typical Android observation model would be to start observation in onStart() and stop observation in onStop().  This sounds simple enough, but often times you'll have several asynchronous calls happening at once, all managing the lifecycles of their component.  It's easy to miss an edge case.  The lifecycle components can help.

Lifecycle, LifecycleOwner, and LifecycleObserver

The core class for all of this is Lifecycle. It uses an enumeration for the current lifecycle state along with an enumeration for lifecycle events to track the lifecycle status for its associated component.

Lifecycle States and Events

LifecycleOwner is an interface that returns a Lifecycle object from the getLifecycle() method, while LifecycleObserver is a class that can monitor the component's lifecycle events by adding annotations to its methods. Putting this all together, we can create lifecycle-aware components that can both monitor lifecycle events and query the current lifecycle state.

public class MyObserver implements LifecycleObserver {
  public MyObserver(Lifecycle lifecycle) {
    // Starts lifecycle observation
    lifecycle.addObserver(this);
   ...
  }
  public void startFragmentTransaction() {
     // Queries lifecycle state
     if (lifecycle.getState.isAtLeast(STARTED)) {
        // perform transaction
     }
  }
  
  // Annotated methods called when the associated lifecycle goes through these events
  @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
  public void onResume() {
  }
  @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
  public void onPause() {
  }
}
MyObserver observer = new MyObserver(aLifecycleOwner.getLifecycle());

LiveData

LiveData is an observable lifecycle-aware data holder class. Your UI code subscribes to changes in the underlying data, tied into a LifecycleOwner, and LiveData makes sure the observer:
  • Gets updates to the data while the Lifecycle is in an active state (STARTED or RESUMED)
  • Is removed when the LifecycleOwner is destroyed
  • Gets up-to-date data when the LifecycleOwner restarts due to a configuration change or is restarted from the back stack
This helps to eliminate many pathways for memory leaks, and reduces crashes by avoiding updates to stopped activities.
LiveData can be observed by many listeners, each tied to a lifecycle owner such as a Fragment or Activity.

ViewModel

ViewModel is a helper class that contains UI data for an Activity or Fragment that serves to separate view data ownership from UI controller logic. A ViewModel is retained as long as the scope of its Activity/Fragment is alive, including when the Activity/Fragmentis destroyed and recreated due to a configuration change; This allows ViewModel to make UI data available to the recreated activity or fragment instance. Wrapping UI data stored within the ViewModel with LiveData provides the data an observable lifecycle-aware home. LiveData handles the notification side of things while the ViewModel makes sure that the data is retained appropriately.

Data Persistence

The Android Architecture Components also simplify data persistence with the Room library. Room provides an object-mapping abstraction layer that allows fluent database access while harnessing the full power of SQLite. The core framework provides built-in support for working with raw SQL content. Although these APIs are powerful, they are fairly low-level and require a great deal of time and effort to use:

  • There is no compile-time verification of raw SQL queries.
  • As your schema changes, you need to update the affected SQL queries manually. This process can be time consuming and error prone.
  • You need to write lots of boilerplate code to convert between SQL queries and Java data objects.
Room takes care of these concerns for you while providing an abstraction layer over SQLite.

Database, Entity, and DAO

There are three major components in Room:
  • Entity represents the data for a single database row, constructed using an annotated Java data object. Each Entity is persisted into its own table.
  • DAO (Data Access Object) defines the methods that access the database, using annotations to bind SQL to each method.
  • Database is a holder class that uses annotations to define the list of entities and database version. The class content defines the list of DAOs. It's also the main access point for the underlying database connection.

To use Room, you annotate the Java data objects you wish to persist as entities, create a database containing these entities, and define a DAO class with the SQL to access and modify the database.

@Entity
public class User {
    @PrimaryKey
    private int uid;
    private String name;
    // Getters and Setters - required for Room
    public int getUid() { return uid; }
    public String getName() { return name; }
    public void setUid(int uid) { this.uid = uid; }
    public void setName(String name) { this.name = name; }
}


@Dao
public interface UserDao {
    @Query("SELECT * FROM user")
    List getAll();
    @Insert
    void insertAll(User... users);
}

@Database(entities = {User.class}, version = 1)
public abstract class AppDatabase extends RoomDatabase {
    public abstract UserDao userDao();
}

Guide to App Architecture 


Architecture Components are designed to be standalone, but they're most effective when they're incorporated into an effective app architecture. Today we're launching a Guide to App Architecture that shows how to build a robust, modular, and testable app using Architecture Components. The Guide has three main goals:


  •  Defining principles that apply to Android app development. 
  • Describing an app architecture that works with those principles. 
  • Showing how to implement that architecture using Architecture Components. 
 We recommend all developers who have had to deal with these problems read the Guide; Even if you're happy with your existing app architecture, the Guide will have useful principles and insights.

Just the Beginning 

We're planning to continue being opinionated, and to continue to introduce new Architecture Components to make it easier for Android developers to make informed choices when architecting their applications. We encourage you to try the preview and provide feedback on what we're doing, because we're all in this together to make robust Android app development easier and more fun. To learn more about Android Architecture, check out:

Google I/O 2017: Empowering developers to build the best experiences across platforms

By Jason Titus, Vice President, Developer Product Group
It's great to be in our backyard again for Google I/O to connect with developers around the world. The 7,200 attendees at Shoreline Amphitheatre, millions of viewers on the livestream, and thousand of developers at local I/O Extended events across 80+ countries heard about our efforts to make the lives of developers easier -- allowing them to focus on the problems they're trying to solve by minimizing the pain points of building a product.
Earlier this morning, our CEO Sundar Pichai talked about our various billion-user platforms. Whether it's Android or Chrome or the mobile Web, our success would not have been possible without the developer community. And during our Developer Keynote, we covered our heavy investments in tools and services for developers who build on our platforms every day.
We have a lot to cover over the next three days. Let's take a closer look at the major developer news at I/O so far:

Platforms that connect developers to billions of users around the world

  • Android O Developer Preview 2 — Get a look at the next release of Android O focused on fluid experiences that make Android even more useful, and our efforts to optimize battery life, startup time, graphic rendering time, and stability. Early adopters can opt in to the Android O Beta Program at android.com/beta and run Android O now.
  • Project Treble — Last week, we also introduced a new Android framework designed to help reduce the time and effort it takes device makers to upgrade a phone to a new version of Android, starting with Android O.
  • Android Go — We're optimizing Android to run smoothly on entry-level devices, starting with the O release. We're also designing Google apps to use less memory, storage space, and mobile data, including apps such as YouTube Go, Chrome, and Gboard.
  • Kotlin — Android is officially supporting the Kotlin programming language, in addition to the Java language and C++. Kotlin is a brilliantly designed, mature, production-ready language that we believe will make Android development faster and more fun.
  • Android Studio 3.0 Canary — Our new preview includes three major features to accelerate development flow: a new suite of app performance profiling tools to quickly diagnose performance issues, support for the Kotlin programming language, and increased Gradle build speeds for large sized app projects.
  • Mobile Web — AMP and Progressive Web Apps (PWAs) are re-defining modern mobile web development. AMP gets content in front of users fast and PWAs deliver app-focused experiences that are reliable, fast and engaging. We're seeing success stories from all around the world - travel company Wego has rolled out a successful AMP based PWA and Forbes has seen user engagement double since launching a PWA. If you're wondering how good your current web experience is, you can use Lighthouse - an automated tool for measuring web-page quality. Be sure to tune in this afternoon for the Mobile Web: State of the Union talk to hear more about building rich mobile web experiences.

Infrastructure and services to take mobile apps and the Web to the next level

  • Firebase — At last year's I/O, we expanded Firebase to a full mobile development platform with products to help you build your app and grow your business. Over a million developers now use Firebase, and we're doubling down on our efforts to simplify more every-day developer challenges. We're giving more insights to understand app performance through Firebase Performance Monitoring, introducing integration between Hosting and Cloud Functions, adding support for Phone Number Authentication, and continuing to improve Analytics in a number of ways. We've also started open sourcing our SDKs.
  • Mobile web developer certifications — At I/O'16 we launched the Associate Android Developer Certification. This year, we're adding two new certifications for web developers: the Mobile Sites Certification and the Mobile Web Specialist Certification.

Powerful tools to acquire and engage new users; grow successful businesses

  • Google Play Console — We announced several powerful, new features and reports in the Play Console to help developers improve their app's performance, manage releases with confidence, reach a global audience, and grow their business. The Play Console also has a new name, to reflect its broadened business uses, and a fresh look to make it easier to get things done.
  • Android Instant Apps — We opened Android Instant Apps, a new way to run Android apps without requiring installation, to all developers. Now anyone can build and publish an instant app. There are also more than 50 new experiences available for users to try out from a variety of brands, such as Jet, New York Times, Vimeo and Zillow.
  • Payments, Monetization & Ads — We introduced a Google Payment API that enables developers to give their customers the ability to pay in apps and online with credit or debit cards saved to their Google Account. New AdMob integration with Google Analytics for Firebase helps them monetize efficiently and updates to Universal Apps Campaigns will help them grow their user base.

New interfaces to push the limits of what's possible

  • Actions on Google for the Google Assistant — We brought Actions on Google to phones, introduced new features and functionality, improved our SDK and more. We also launched the Actions Console, a new developer console that helps developers work as a team, and collect data on app usage, performance and user discovery patterns. This new console is integrated with the Firebase and Google Cloud consoles.
  • VR and AR at Google — We'll have more to share on the latest Daydream platform features and developer tools during our "VR and AR at Google" session tomorrow (May 18) at 9:30 AM PT in the Amphitheatre and on the livestream.
It's important to us that developers are successful. In addition to building products that help solve developer challenges, we're on the ground in over 130 countries, growing and expanding the developer community through programs such as Women Techmakers & Google Developer Groups (GDGs). We're also investing in training programs like Google Developers Certification and courses through Udacity and other partners to help developers deepen their technical capability. We're also excited to announce two large multi-product developer events, Google Developer Days, which are planned for Europe (September 2017 in Krakow, Poland) and India (December 2017 in Bangalore, India). If you are interested to find out more, sign up for updates on g.co/gdd2017.
During Google I/O, attendees and viewers have an opportunity to dive deep into a number of these areas with 14 content tracks and 140+ breakout sessions -- covering Android to Assistant to VR -- and all livestreamed. We've also launched over 70 codelabs to get developers up and running with our latest APIs today.
Whether it's Android, Chrome, Play, VR/AR, the Cloud, and the Mobile Web — we're constantly investing in the platforms that connect developers to billions of users around the world. Thank you to the continued support and feedback from the developer community.

Android Announces Support for Kotlin

By Mike Cleron, Director, Android Platform
Today the Android team is excited to announce that we are officially adding support for the Kotlin programming language. Kotlin is a brilliantly designed, mature language that we believe will make Android development faster and more fun. It has already been adopted by several major developers — Expedia, Flipboard, Pinterest, Square, and others — for their production apps. Kotlin also plays well with the Java programming language; the effortless interoperation between the two languages has been a large part of Kotlin's appeal.
The Kotlin plug-in is now bundled with Android Studio 3.0 and is available for immediate download. Kotlin was developed by JetBrains, the same people who created IntelliJ, so it is not surprising that the IDE support for Kotlin is outstanding.
In addition to the IDE support, we're announcing a collaboration with JetBrains to move Kotlin into a non-profit foundation. (Kotlin is already open sourced under Apache2.)

Say "Hello" to Kotlin

Kotlin will be very familiar to anyone who has used the Java programming language.
package helloWorld

fun main(args: Array) {
   println("Hello World!")
}
At first glance, you will see comforting elements like curly braces, classes, packages, functions and methods. But as you go deeper, you will discover that although Kotlin is based on familiar concepts, it is a uniquely modern, elegant and pragmatic riff on those models. In particular, Kotlin is highly expressive with minimal syntactic friction between your thoughts and what you have to type in order to express those thoughts. If when writing code you have asked yourself questions that began "why do I have to …?" you will be pleased to learn that in Kotlin the answer to many of those questions is "you don't!"
For example, perhaps you have asked why you need to type in a bunch of boilerplate getters and setters as well as overriding equals(), hashCode() and toString() when implementing a simple class. Here is a typical example from the Java programming language (in a microscopic font for brevity).
public class Customer {
   private String name;
   private String email;
   private String company;

   public Customer(String name) {
       this(name, "", "");
   }

   public Customer(String name, String email) {
       this(name, email, "");

   }

   public Customer(String name, String email, String company) {
       this.name = name;
       this.email = email;
       this.company = company;
   }

   public String getName() {
       return name;
   }

   public void setName(String name) {
       this.name = name;
   }

   public String getEmail() {
       return email;
   }

   public void setEmail(String email) {
       this.email = email;
   }

   public String getCompany() {
       return company;
   }

   public void setCompany(String company) {
       this.company = company;
   }

   @Override
   public boolean equals(Object o) {
       if (this == o) return true;
       if (o == null || getClass() != o.getClass()) return false;

       Customer customer = (Customer) o;

       if (name != null ? !name.equals(customer.name) : customer.name != null) return false;
       if (email != null ? !email.equals(customer.email) : customer.email != null) return false;
       return company != null ? company.equals(customer.company) : customer.company == null;
   }

   @Override
   public int hashCode() {
       int result = name != null ? name.hashCode() : 0;
       result = 31 * result + (email != null ? email.hashCode() : 0);
       result = 31 * result + (company != null ? company.hashCode() : 0);
       return result;
   }

   @Override
   public String toString() {
       return "Customer{" +
               "name='" + name + '\'' +
               ", email='" + email + '\'' +
               ", company='" + company + '\'' +
               '}';
   }
}
In Kotlin, you don't have to type any of that. This single line is equivalent to the entire class above.
data class Customer(var name: String, var email: String = "",
                    var company: String = "")

History and Reference

Kotlin has been around for quite a while; it was announced back in 2011 and the first preview was released in 2012. Kotlin 1.0 was released in 2016, at which point JetBrains committed to maintaining backwards compatibility for stable features from 1.0 forward.
You can find excellent training material and references at https://kotlinlang.org/. The Android team has found the Kotlin Koans tutorial to be especially helpful as a quick way to get started writing some Kotlin snippets. These tutorials range from the simple to the sublime as the material progresses from the basics to more sophisticated Kotlin idioms.

Why Kotlin?

Why did the Android team decide to support Kotlin? Most importantly, it was because we think Kotlin is a great language that will make writing Android apps easier and more enjoyable.
Kotlin is also a great match for the existing Android ecosystem. It is 100% compatible with the Java programming language. You can add as little or as much Kotlin into your existing codebase as you want and mix the two languages freely within the same project. Calling out to Kotlin code from code written in the Java programming language Just Works™. Going the other direction usually works without any developer effort too via some automatically applied translation conventions (for example, things like property getters and setters are created for you). With the help of a few Kotlin annotations, you can also customize how the translation is performed.
Finally, many, many developers have told us they love the Kotlin language. (Many of our own developers on the Android team have also been saying similar things.) There is already an enthusiastic community of Kotlin developers for Android, and the Android team has been routinely peppered with questions about Kotlin at public events. The Android community has spoken, and we listened.

A Quick Tour

To help you get a sense of where all of the excitement around Kotlin is coming from, here is a quick, very-much-not-comprehensive tour of some of the particularly appealing aspects of Kotlin:
Nullable
The Kotlin compiler enforces that variables that can hold null values are explicitly declared – thus no more NullPointerExceptions at runtime!
var neverNull: String = "something"
var mightBeNull: String? = null // "?" indicates this can be null

if (neverNull.length > 0) {   // This is OK
    …
}

if (mightBeNull.length > 0) { // Compiler catches this error for you
    …
}
Named parameters and default arguments
We've all seen methods that have too many parameters to keep track of. For example:
fun orderPizza(size: Size, pepperoni: Boolean, mushrooms: Boolean,
               ham: Boolean, pineapple: Boolean, pickles: Boolean,
               sausage: Boolean, peppers: Boolean, onion: Boolean)
{
    ...
}

// Wait… did I just order pickles on my pizza?
// Why do we even have that option?
orderPizza(Size.LARGE, true, false, false, false, true,
           false, true, false)
Compare that to a similar scenario using named parameters and default arguments:
fun orderPizza(size: Size,
               pepperoni: Boolean = false,
               mushrooms: Boolean = false,
               ham: Boolean = false,
               pineapple: Boolean = false,
               pickles: Boolean = false,
               sausage: Boolean = false,
               peppers: Boolean = false,
               onion: Boolean = false)
{
    ...
}

orderPizza(Size.LARGE, ham = true, mushrooms = true)
In addition to helping to avoid tragic pizza outcomes, this is much easier to read. It also reduces the number of variants of overloaded functions you need to write.
When statement
Kotlin has a variation of a switch statement that allows matching on arbitrary expressions.
// Please don't put this in your app!
when {
    password.equals("password") -> println("Insecure password!")
    password.length < 4 -> println("Too short!")
    else -> {
        println("Secure password!")
    }
}
Smart Casts
Why should you have to cast something to a class right after you just tested that it is an instance of that class? In Kotlin, you don't have to do that anymore.
if (obj is String) {
    // Compiler casts obj to a String for you.
    // (Would work with && instead of nested ifs too.)
    if (obj.length > 0) {
        …
    }
}
This generalizes to the when statement as well:
// Assume reasonable implementations of Cat and Dog
when (obj) {
   is Cat -> obj.meow(...)
   is Dog -> obj.woof(...)
   else -> {
        …
   }
}
Extension functions
Kotlin lets you essentially retcon new methods onto an existing type. If you, like many people, wish that the String class had a toPigLatin method, you can now add it yourself without having to create a new helper class to wrap String or going through the trouble of serving on a language committee:
// The "String." prefix indicates that this method should
// extend the existing String class
fun String.toPigLatin() : String {
    ...
}

val plainOldString : String = "some text"

// Can now call toPigLatin as if were a method on String
println(plainOldString.toPigLatin())

// Or:
println("some text".toPigLatin())
Destructuring Declarations
We have already seen how easy it is to define a simple data class:
data class Order(val itemCode: String, val quantity: Int,
                 val price: Float)
A function that uses one of these classes as the return type is very close to supporting multiple return values:
fun getOrder(...): Order {
    ...
    return Order(itemCode, quantity, price);
}
To get all the way there, you can use the destructuring declaration syntax. The following statement takes the Order object, extracts its three properties, and then assigns them to the three variables what, howMany and howMuch — all courtesy of the Kotlin compiler, which also infers the correct types for you.
val (what, howMany, howMuch) = getOrder(...)
Lambdas
Kotin has an extremely concise syntax for lambdas that makes is easy to express powerful functional programming paradigms. Here's a simple example that uses a lambda to test that everything in a collection is a String:
fun allStrings(collection: Collection)=
    collection.all { it is String }
That lambda syntax is building block of one of Kotlin's coolest features: the ability to create builders that use JSON-like syntax that also happens to be syntactically valid Kotlin. This example is adapted from an extended discussion here, but you can get the flavor of what it possible with this snippet:
fun generatePage(withEmphasis : Boolean) {
    val result =
        html {
            head {
                title { +"Kotlin Builders" }
            }
            body {
                h1 { +"Kotlin Builders" }
                p {
                    +"This is "
                    if (withEmphasis) b { +"really " }
                    +"interesting"
                    a(href = "https://goo.gl/rHwJio") { +"More here" }
                }
            }
        }
    println(result)
}
There are a couple of interesting things going on here. First, this shows how expressive Kotlin's functional syntax can be: in this example, "html", "head", "body, etc. are all just functions written in Kotlin and the stuff in curly braces that follows are functional parameters. (This snippet uses functions with names that match HTML tags to build a representation of a web page, but of course you can use this pattern to build any complex data structure with whatever names you want.) The second interesting thing is the "withEmphasis" conditional. This may look like we are mixing code (if (withEmphasis) …) with data (all the HTML-esque tags), but the "data" here is actually just more code. Since it is all really just code, this lets you build complex data structures using a declarative syntax while also having inline access to the full capabilities of the Kotlin language.

Getting Started

If you want to get started with Kotlin, you can start playing with code online immediately here. Just hit the green triangle to compile and run.
To try Kotlin in your app, follow these steps:
  1. Download Android Studio 3.0
  2. Open one of your existing ".java" files
  3. Invoke "Code > Convert Java File to Kotlin File"
The IDE will then walk you through adding Kotlin dependencies into your project, and then convert the code to functionally equivalent Kotlin code. (The IDE will also offer to touch up all of the call sites to the converted class when suitable to be more idiomatic Kotlin such as when static methods are moved to companion objects.)
You can also find a lot more information on how to start using Kotlin on developer.android.com.