Tuesday, May 8, 2018

Slices & App Actions are Android P APIs that bring your app’s content to Google Assistant

For independent app developers, the work that comes after the actual app development can often be the hardest part of the job. How do you get people to learn about your app? And once you start gaining a few users, how do you retain them? Engaging users, so they keep returning to your app (and thus not uninstalling it), is key to building a stable, dedicated user base. That's why Google is introducing new APIs in Android P called Slices and App Actions.

With the dozens, maybe even hundreds of applications installed on users' devices, it's hard for your app to compete for a user's attention. You want a user to frequently open up your app so you can serve them more content, thereby keeping them engaged and potentially generating more revenue. As users shift their attention away from individual apps to content aggregators such as Google Feed, you need to find a way to surface your app's content where people are spending most of their time. The new Android P APIs help developers do just that by allowing you to display snippets of your app's UI (Slices) or contextual actions based on your app's capabilities (App Actions.)

Using the new Slices API

Some of the more astute observers among you may have noticed the new Slices API appear in the API documentation released with the first Android P Developer Preview. The documentation is rather vague, but today we have a clearer picture of the vision that Google has for this new API. It's a way for third-party applications to surface their content into apps like the Google App, but in a way that's dynamic, interactive, and seamless. Slices can include live-data, scrolling content, inline actions, and deep-linking into your app so you have a lot of choice about what content you want to show the user.

Say for instance that you're building a travel planning app for a hotel chain with the ability to check in/check out of the hotel. If the hotel sends email confirmations to the user and the user has Google Feed enabled, then Google can keep track of the reservation. But that doesn't bring users to your app, does it? With the Slices API, you can instead surface the reservation in a more natural way when the user searches for a term relevant to the booking.

Android Slices Android Jetpack

Slices in the Google App. Source: Google

What if you're a developer building a slick new music player with a Material Design interface? If a user built a playlist in the app and you want to remind them of those sweet tunes, you could inform the user when they open the Google App and search for a related song, artist, album, etc.

Android Slices

Music playlist Slices example. Source: Google

Lastly, let's say you're working on an app for a ride-sharing company or other related business. If a user searches in the Google App for a way to book a relevant service, you could offer up an interactive Slice of your app that lets them quickly complete the booking.

Android P Slices

Slices from the Lyft app. Source: Google

Each of the Slice designs shown above appear unique but they all follow the general design principles that you are likely familiar with. The API allows you to style the Slice you offer to the Google App, though the base style is based on the Android notification so your Slice's appearance shouldn't differ too wildly from other Slices.


There's clearly a lot you can do with Slices. If you're interested in building your app with this API, you can learn more about it here. Major companies such as CNN, HBO, USAA, and Alibaba are already working on adding support for the API, we're told. Slices are compatible with 95% of Android devices on the market thanks to the minimum SDK version of the compatibility package, so your Slices will reach a large audience once they go live in the Google App.

Lastly, some of you may be wondering if other applications can receive Slices. The answer is no: Only system applications can. That's because the permission required for an app to act as a SliceManager to receive Slices from a SliceProvider cannot be granted to third-party applications (android.permission.BIND_SLICES.)

App Actions

The new App Actions API in Android P is intended to contextually provide users a variety of predicted actions to choose from. You can think of it as the Reply app for smart replies (or Android P's smart reply API) but instead for actions. App Actions appear based on usage and relevance across multiple apps such as the Google App, Play Store, Google Assistant, and the Pixel Launcher. The App Actions API uses the same set of intents as Actions on Google Assistant.

App Actions Android P Google Assistant

App Actions in Android P. Source: Google

If you're interested in learning more about App Actions, then you can sign up to be notified when it is available.

from xda-developers https://ift.tt/2wmg4pp