A major theme in Android 9 Pie is leveraging AI and thinking in terms of predictability. As mentioned in our overview of what’s new in Android 9 Pie, Google was clearly focusing on a range of features powered by AI. One of them is App Actions which predicts users’ next actions based on context. In this post we’ll look into something that can be a great complement to App Actions and is by far the most pie-appropriate announcement in the release—Slices.
Although at the time of writing the exact timeline for launching Slices (as well as App Actions) still remains unknown, we should be able to use them later this year. However, since Slices are a part of Android Jetpack (the androidx.* package libraries) announced at Google I/O, they have already been available for developers to experiment with. So let’s find out what Slices are exactly and get started!
Slices: The Key Ideas
To put it simply, Slices are pieces of app content that can be surfaced outside of the app. Their purpose is to become a reusable API that would generalize how remote content and actions are presented in the system. Slices will show up in Google Search app as a result for user’s queries, later on they will be available in Google Assistant as well.
Google based their design and development of this idea on the following three principles that define Slices as:
- Templated - Allowing flexible and rich content that is also predictable, dependable, presentable and easy to render on a wide variety of surfaces.
- Interactive - Giving the user rich content previews, making inline task completion possible and very easy.
- Updatable - Google’s plan is to iterate Slice releases quicker than the traditional platform releases in order to introduce more types of slice content and new Slice templates, as well as to enable new places for slices to appear.
Slices In Search
The upcoming integration into Google Search basically means that Slices will appear in Autocomplete along with web and query predictions. The app has to be installed on the devices in order to appear in Search. If you want your app featured among the results, there are types of Slices that you could go with:
- A “canonical” Slice for your app. This will be the Slice that shows up when user searches for your app’s name in Google Search.
- Slices that are presented when user searches for general terms, e.g. “get a ride”, “trending videos”
Making your Slices appear when user searches for certain keywords would require adding Firebase App Indexing to your app. It is a framework that surfaces links to app content on Google Search. It would be integrated in the following way: Firebase App Indexable metadata would be tied to a Slice, also the appropriate content URL would have to be added in the Android app’s manifest. Currently the API for adding this binding is yet to be launched. Note that the ranking would depend on confidence and might vary by search terms.
Slices in Google Assistant
Slices can also serve an UI enhancement for App Actions. An action is essentially an interaction that supports a specific intent coming from a user. Actions must have a corresponding fulfillment in the form of a service or an app that processes user’s intent. Google has a growing catalog of Intents with their own data schemes you can choose from. You’ll also be able to define your own custom intents.
Although there is not much information on App Actions available at this time, we know that developers would have to create a mapping between App Actions and URLs that can be handled by the app (in a file called actions.xml). Then these deep links would be matched to the appropriate Slices by a SliceProvider in the app.
What kind of content can Slices hold?
As mentioned earlier, Slices are templated, and from an engineer’s standpoint, they are pieces of data containing the actual content bundled with the information describing the template (layout) to present this content in. You can combine available templates to build rich and interactive Slices based on what users could accomplish with your app. A user would typically want to view new content they’re interested in, they could be reminded of the existing content (like seeing photos from a trip they went on), they might want to complete a certain task right then and there, etc. Slices can contain icon buttons, images, timestamps, standard and custom toggles, progress bars, sliders. All these elements are placed within rows, lists and grids of content. Below you can see some examples of what Slices may look like.
However, developers have limited control over styling here. Ultimately it is the displaying surface determines how to render Slices, it can also slightly customize their look and format. The example below shows the same Slice presented in three different formats: large, small and shortcut.
That looks cool… but do I really need to build Slices?
Yes! Most likely you do, if you want your users to keep coming back to your app! According to Localytics, one out of five users will never launch an app again after one session. Retaining users, keeping them loyal and engaged has always been a tough task for the majority of app developers. Slices are shown right when the user wants to perform a certain action which is the perfect timing, so this makes them a great incentive that triggers the user to come back to your app.
As a final word, I would like to encourage you to start thinking about how your app can benefit from Slices today. Despite not having the exact metrics to show it yet, we believe that offering Slices from your app and having your app featured in Search and Google Assistant will positively affect user engagement and the desired outcomes. That being said, don’t wait; adopt Slices early! If you want to learn about Slices in more detail and get started fast, attend my Droidcon NYC session on Slices called “Slice It Up: Driving user engagement outside your app”.