Duration 24:19
16+
Play
Video

Android Slices: build interactive results for Google Search

Mady Mellor
Software Engineer at Google
+ 2 speakers
  • Video
  • Table of contents
  • Video
2018 Google I/O
May 8, 2018, Mountain View, USA
2018 Google I/O
Video
Android Slices: build interactive results for Google Search
Available
In cart
Free
Free
Free
Free
Free
Free
Add to favorites
21.77 K
I like 0
I dislike 0
Available
In cart
Free
Free
Free
Free
Free
Free
  • Description
  • Transcript
  • Discussion

About speakers

Mady Mellor
Software Engineer at Google
Jason Monk
Software Engineer at Google
Artur Tsurkan
Product Manager at Google

Mady is an engineer on the Android System UI Team. Mady joined the Android team in 2014 and has worked on text selection, notifications, and now Android Slices! Prior to joining Google Mady earned a bachelor's degree in computer science from the University of Waterloo in Canada.

View the profile

Jason is an engineer on the Android System UI Team, and is the technical lead on the Android Slices Project. He joined the Android Team in 2013, just before Android KitKat launched. Prior to joining Google he received his M.S. in Computer Engineering from the University of Maine.

View the profile

Artur is a product manager on the Android System UI team. He drives product on a number of features including Slices, Always on Display, and At-A-Glance. As part of the Associate Product Manager program, he previously worked on the Google Image Search team on rich metadata and actionable experiences. Artur has a Bachelor of Business Administration degree from the Ivey Business School, Canada.

View the profile

About the talk

Slices is a new, backwards-compatible API being introduced as part of the Android P release, which enables a single and consistent way for apps to present their content and actions across Android and Google surfaces, through developer-customized templates. In this technical session, we will cover everything you need to know to build Slices, and provide an early preview on what's required to have them appear as interactive result predictions in Google Search on Android.

Share

Awesome. Good morning everyone. My name is ours were I'm a product manager on Android system UI on Android system UI to talk to you about Android slices and how you can use them to build interactive results for Google Search. Stop before we get into the details. I wanted to start by answering the question of what spices are at a high-level slices are Android's new approach for remote content. There's a couple of important aspects to this. The first is that slices

are templated what we mean by this is that we are going to provide you with a flexible and Rich mode of expressing your app. That's also predictable and dependable for the bacon be presented by a wide variety of surfaces. Prices are also are active these templates House of Riley of components to enable anything from Rich content previews to inline task completion. And also spices are updatable. We're going to be able to iterate much more quickly than the traditional python releases to enable new places for these spices to appear and you types of slices for you to express your app. Most

importantly places are backwards compatible all the way back to Android KitKat, which means that as they launched their going to be available for 95% of Android devices. What's against somebody pull up in a little bit more detail? Always say slices are templated. We mean that we are providing you with a rich layout and content system to enable a wide variety of app use cases. These templates are not plug-in play. They're flexible in a pencil in that you define a wide variety of elements and Define them in a priority order so that to enable a rich variety of ways to express your app anything

from a weather forecast to reservation music playlist to home automation and that he's going to go into more details on how you construct these Prices are also interactive. They're not just static data. They can how is a variety of components anything from real-time data that's directly from the APK on a user's device. For example surfacing the latest prices for ride-sharing as well as Rich controls, like actions toggles Fighters and scrolling content. So that users can complete the task in line right where the place is being presented. Prices are

bundled with jetpack. That means that we can more frequently expand and enter a spices. That means we can add more presenting surfaces to expand your apps reach more templates to represent your apps use cases and more controls and components to make those slices more engaging and more powerful for users for the future. Go to sounds pretty great for the really important question is where a slice is going to be available. For users. Where are we launching? This year places are launching in search where we're going to use slices to enhance a predictions

as the user a searching there going to be two main use cases in terms of how slices will it be the first is for app names. So as a user is searching for the name of your app will be able to surface what you may call a canonical splice for your app to help accelerate some sort of tasks, but will also support general term searches. So that users are able to search for an app or a specific feature. And of course because slices are backwards compatible when they start appearing in search you'll be able to reach all hundreds of millions of users that are available on Google search today.

This is really important because with slices you're going to be enabled you're going to be able to enable a wide variety of really great use cases for folks on search. For example here a couple of three buckets that we are likely to share to get your juices flowing. The first is a navigation use case. This isn't that the user is searching for something that they already know. They want to get you a ride home. If you can use real-time data to provide additional contacts for that decision so that they know the price and time to their destination and they can just start thinking about booking

the right right from the search results. They also enable inline task completion you might be able to use those are active controls. I was referring to earlier so that hops like setting is can enable users to quickly search for a setting and chocolate in line. And finally you can use slices to enable recall and discover. Use cases users might be searching for things that they didn't even realize it's available in your app, but because it's installed in their device and that you can stir fry spices for it. You might serendipitously surface that content for Explorer but this is only just

beginning our goal with slices is to enable one reusable API to generalize Road continent Android and different things that were exploring is trying to make slices more tightly integrated into the system as well as more Google platforms. I'm going to hand it off to Jason sock little bit more about slices architecture. Thanks Arthur through actually building your first slices. But before that I want to give you a little bit of an idea of how slices work and what they how they look under the hood. So what are sliced actually is in terms of you note implementation is it's

structured data and a structured data contains other slices content and presentational hits. And so I think the note this is not actually code on the screen. I know it looks kind of like a DSL on but this is really a strong representation of what you would construct once you're actually done building a slice on there a few things that we extract out of this information the structure that it has determined to the template and like what we're saying like this example of a horizontal weather slice it also contains the content itself

icons text pending intense for inactivity. And the other thing is that this contains all of the data for this life no matter the format through all of the formats that You have four slices right now and how we may I add more in the future to but a single slice that you returning your ass will actually hold all of the formats and so on the right, we have a shortcut version of that thing slice and that is using the exact same data represent in a different format. All right. So how do you have to actually get ahold of slices from your app so slow on top of content

providers as a content provider? I don't worry. We try to hide as much of the content provider as possible for you, but there are few really nice things that come out of this is that they're based on top of content. Uri's which means you can have a wide variety of slices hosted from your app and when and a half wants to show your slice you'll get a call back to unbind slice and you'll get a year or I will get to decide what content you want to connect it to that. You are I and return it in that slice that I just showed you but then there were active do you need to actually be able to update

that and the way that works is through a note if I changed you send a standard content provider. If I change on your slice URI and whoever is presenting your slice will know that it's time to update and they'll give you another call back and you can return different data that is you know, dynamic and changes in response to whatever has happened. All right. Now I'm going to hand it over to Maddie who's going to walk you through building your first slice. Thanks, Jason for that architectural overview. And I'm going to walk you through an app creating this

wi-fi slice today. So we're going to build a place providers that provides his wife ice place that has toggle and Topping the toggle will turn Wi-Fi on and off and I'm not connected state will change my son's the Why by state? So the first thing you got to do is Define as like provider in your Android manifest as Jason mentioned places are built on top of content providers to so much work on a provider. You got to find a cure this what's the operating system people to find your slices. Then you have to implement your slice

provider a Sole Provider. This week's provider handles multiple slices here. So we have a wife I slice an alarm slice and a Night Lights life. So what will happen when when something is trying to display or slice you might type in Wi-Fi into Google search and it's going to do some ranking stuff that Jason will go into some details later. And it'll match that search term to contact you or I and in our case that contact you or I will be this wi-fi. Based on that we're going to build a Wi-Fi slice will jump into

this method places start with less Builders. So list Builder accepts different kinds of rows of content. This place is fairly simple as a single row. I'm sweetie for start with Arles Builder and we build a robot are based off of it. We add the Wi-Fi title. And then we kind of do this weird thing where we check if I see this loaded maybe it take some time for us to determine whether Wi-Fi is connected or not. And we need to do that in the background. In the meantime. We're still going to return a slice with the content we intend to display but we kind of note that this content is

loading so The toggle we don't know the state and the connected text. We don't know whether we're connected or not. So these two pieces we need to indicate there. They're going to be loaded we do that just by passing though and Abilene on the Builder. We done a. Row to the list Builder and we both this life. So meanwhile, our Wi-Fi state has been loading maybe when this is done it we got to call back to you on Wi-Fi State loaded. We flip our flag. And now we need to let the UI note to update. So I Wi-fi place is being

displayed somewhere and it is our sad little loading state with just the Wi-Fi text to update to get that subtitle string and the toggle action and we do that with content resolver notify change on the full contact URI for that place. Do you got a call to you on buying place again? It will be the same Wi-Fi URI. You'll walk into your bill of Wi-Fi slice method and this time or Wi-Fi stays loaded so we can check whether we're connected or not set that subtitle text and create our toggle action. So this get Wi-Fi

toggle action is going to create a slice action. This is how we represent actions and slices. So depending on time and then take some extra information to represent the action in our case. We want to respond to someone tapping on the toggle. So we need to have a broadcast receiver to receive at pendingintent and do some stuff to update Wi-Fi state. Rebuild a slave auction without intent a label in describing the action and then a Boolean value representing whether it is total is on or off.

So in our case that Wi-Fi state So when you pop on that taco that pendingintent get sent your fuel Define this field of finding broadcast receiver for your app at a handle this intense in our case. We need Wi-Fi manager to update Wi-Fi State something that place is just for toggles is the Wi-Fi was on I tap on that toggle. Stop pending until I got sent will attach the resulting state of the toggles this extra toggle State 2010 so that you can retrieve it and know what the you say to

the talk Les. Will you got to update the Wi-Fi and then we're going to notify our content URI so that any slices any Wi-Fi slices being displayed no to update because Wi-Fi state has changed. So how do you test he's right. Now? We've got this great tool slice viewer on it allows you to and put your contact your eyes for your slices. And then you can preview your size and display the slices in different mode. So it's Jason mentioned we had that shortcut and then larger templates as a service to allow you to exercise those different modes.

That's like the support and the getting started getting started guide us great. I'd highly recommend it summary of creating a slice from a not you have your slice provider in your manifest. You implemented you map your continual rise to the different places that you're out supports and then you build up and handle any events. end-of-course test Play templates. Play the song has a really great tumbling system. We think it's pretty flexible. And we hope that we'll be able to support many of your apples cases.

This is an overview of the different types. We support. As I mentioned everything starts with a list Builder and list Builder you attach different Rose to it. So this kind of the slides are the shows the different rows that we support and I usually text toggle sliders progress bars different kinds of grid layouts and these are all kind of flexible. So nothing is enforcing requirements of contents. You can kind of pick and choose how do you say it? So as mentioned you add these to list Builder and you can kind of see in these

layouts how you can express your app uniquely with the system. So Wi-Fi slaves here is composed of just different types of rows that supports the toggle it can do a list of Wi-Fi networks are reservations slice for your upcoming trip in Seattle gives you the important information gives you a preview of your rental and then check-in check-out locations using a big picture and then a grid layout with two cells. Animusic sliced it's interactive. You can favorite things. You can control your music from it. It's scrollable. And so I hope that you can see have

your app. Use cases can be represented in our template system. The multiple formats is Jason mentioned you provide a slice with all of your all of the data. We need to present in these different format. We want slices to be able to move across the operating system in different spaces and they might need to shift their form based on that. So we're supporting a shortcut for him, which is just a small top of alike on a small slice which is the first row of your slice John early and then a large slice which is all of the content when your blinkers lights keep that

in mind make sure you test a different mode so that the slice displays how you expect it to these formats. Thanks for letting places can also customize then as so they've got some flexibility with increasing font size changing the font style and maybe overriding any color that you said cuz we want spaces to sort of feel at home in the surface that they're being presented in. Singing to walk you through an example to build this home site, which allows you to control your temperature and see the many video cameras that you might have in your home.

So again starts with a list Builder here. We defining to slice actions for turning the temperature up and turning the temperature down. Please just take a pending and X icon compat and then a labeled we create our row we set our title and subtitle at the two actions are the road to the list. And then we thought that top part of the slice. So we'll do the second part. Now the camera snap shots. Maybe we'll gather data for this. This is a good rose. So we'll build Define degrade row Builder. And then for each of the data elements for

displaying in these cells will out of cell to the grandmother and the seller will take an image title text and text and these are displayed in the order that you add them to the cell Builder. So if you want, what do you mix them up? They don't need to be image text text Tiffany text image text to get it's flexible. I thought Creed road to the list and then you felt your slice. And Jason is going to take it away to describe how you can get these slices appearing in Google search. Thanks, buddy. All right. So like Archer said we got two cases that were talking

about for Google search. These are both showing up in predictions. So, you know that you can tap on the search bar type of few characters and the user will be interacting with your app. Basically at that point. One thing to note. This is only for apps installed on your device. We are currently doing anything with instant apps or stuff from the cloud and these next few slides are really just a preview. We're going to be launching all sorts of documentation when we officially ship this play to The Summit. All right. So let's talk to her how you do this for an app named their two things you

really need to do. In this case. You need to link of specific slice to your main activity of your ass. That's the activity that shows up in launcher and the activity that spotted with the name that users will search for and you need to grab some permissions. So when Guinea activity is actually really really simple you just add one piece of metadata into your manifest and that metadata points that any slice URI you want within your app. And that's the URI that you can expect to get bound. When users type in the name of your app. You also need to grab these permissions exposed to H2S

search and Play services so that it has access to read you your slice and display properly will talk a bit more about permissions and put in a little bit but these are basically the lines of code you need to do for a default device for Barnett. Why are naps lights? Okay, so the the bit more broad range of general terms. This is a little bit more complicated. The another thing to note is that ranking Mayberry is that you know search is going to try to prevent whatever content is best for the user. And so you can't always guarantee that your app is going to be shown but that can be enhanced

with a bit of you know, you said your boarding and stuff like that. There are a few things to do here at this is based on top of Firebase app indexing, which is existing apis. You can go right about then we go to Lincoln the next light and you tie those Firebase app indexing content directly to a slice and so that will let search know when it triggers that app indexable that it should be showing a slice for that. So the way you do that is when you are pushing your app and taxable. There is some meditating you can tag. There's new apis on apidexin that will be launched with this which

will let you specify your slice URI. Are there another piece of this is that there's a little bit of content validation. So when you're doing app indexing, you need to specify a Content URL and that content you were all needs to map to the same place that you're special time with your app is just a linking sort of a system to verify that you've got the right content showing and to the way that works is there two things you need to do one is you need to add an intent filter to your provider. These have been supported but I rarely used in Android for some time these look very similar to

a blinking if you're familiar with verify. Blinking around this will look pretty similar to you by this intent filter is an example of looking for anything on HTTP colon example.com anything you can also do if you don't have app like him set up for your app. You can do your own URL schemes like in the settings app in Android we're doing settings for flashlights whatever for our deep links and that's how u r l skate. The only thing you do is once you've added an intent filter for your for your provider, you can expect that you're going to get calls to on map intent to your eye this let

your apps say I've got some intent in coming in 10 Tater and intense archive squishy, you know intense aren't as defined as your eye and this gives you the moment to say like here I'm going to take this intent and I'm going to resolve it to an exact you or I and this is the place I want to show and so you can do whatever you want within this function to it to determine your path. In this case. It's just kind of like taking the data off from the intent and pushing it over to Authority with the witch hazel sliced provider, but you can you can add your own logic of your own kind and that's

how you add those. All right. So that's kind of a whirlwind tour. I know we'll be launching more docs with that when we when we officially launched search now, hopefully your slices are holding all sorts of really great content and you don't want to expose that conscience the world so you probably really care about how the permission to work here. There are three ways that a napkin get ahold of permissions for your slice the first did you get fine grain permission control? These are very similar to URI permissions except we designed them to scale up cuz we expect people to have a lot of

slices over time these happen automatically for you. If you're using the Firebase app indexing apis, we just told you about will do those permission grants for you. You notice in the default apps like you didn't have that Firebase app indexing which is why you had to Grant the permissions yourself in the second case that is different about these from your eye permissions is that the user can grant permission when when an app doesn't have permission to to show your slices are the system will return what we call a permission flights and what it looks something like this on the right

where it says like, hey this have tried to show slices from someone else and the user can actually explicitly Grant Warehouse can get sliced permissions is a 20 plus. We're Auto granting permission to launcher in the assistant to really be able to do the do a seamless kinds of splice Integrations in the future. And so if the user clicks on that permission place that I mentioned they're going to see a dialogue and they can choose, you know to either to Grant permissions or not to Grant permissions. Try to give them some transparency as to what's going on and how they're exposing

data from your app because it's so how does this work for you the way it works for you is that you should expense life provider because you're going to need you for everything and slice providers going to handle all this permission checking for you, please don't add Android call information to your provider's as you're used to in your manifest that's going to break everything. And also if you have really really center today to ask you something like a banking app and you feel like oh no the, you know, I could use your could really really shoot themselves in the foot here. You can override on

crane permission request and that will let you disable disable the user Grant and like redirect them to some other dialogue you can you can have your own sort of flow there to to ensure privacy. All right. I'm going to pass it back to Archer to wrap things up. Awesome. So that was a lot of information if you're interested in learning more, please go to this short link G. Co / slices in here is everything related to our getting started guide as well as links to use and download the slices you were building your first slice and all the details that you need to know

about creating all the rich templates that Maddie talked about will also be available today and tomorrow at office hours. I will be posted our thank you for as well as the Android sandbox if you have any direct questions, We also want to hear from you. So please go to this google.com / iOS by scheduling to provide feedback on the session. But thank you all again so much for coming out in the wee hours of the morning and hearing us talk about spices as well again, you can I follow these the fall of actions to learn more. We'll have a bit of time for questions right now if anyone has

anything they want to ask

Cackle comments for the website

Buy this talk

Access to the talk “Android Slices: build interactive results for Google Search”
Available
In cart
Free
Free
Free
Free
Free
Free

Access to all the recordings of the event

Get access to all videos “2018 Google I/O”
Available
In cart
Free
Free
Free
Free
Free
Free
Ticket

Interested in topic “Software development”?

You might be interested in videos from this event

September 28, 2018
Moscow
16
159
app store, apps, development, google play, mobile, soft

Similar talks

Dave Burke
Software Engineer at Google
+ 6 speakers
Romain Guy
Senior Staff Software Engineer at Google
+ 6 speakers
Chet Haase
Leads the Android Toolkit team at Google
+ 6 speakers
Dianne Hackborn
Product Manager at Google
+ 6 speakers
Aurash Mahbod
Director of Engineering at Google
+ 6 speakers
Tor Norbye
Tech lead for Android Studio at Google
+ 6 speakers
Stephanie Saad
Software Engineer at Google
+ 6 speakers
Available
In cart
Free
Free
Free
Free
Free
Free
Krishna Kumar
Product Manager at Google
+ 1 speaker
Mariya Nagorna
Senior Technical Program Manager at Google
+ 1 speaker
Available
In cart
Free
Free
Free
Free
Free
Free
Raj Ajrawat
Global Product Specialist Lead at Google
+ 3 speakers
James Bender
Product Manager at Google
+ 3 speakers
Amrit Sanjeev
Developer Advocate at Google
+ 3 speakers
Steve Suppe
Product Manager at Google
+ 3 speakers
Available
In cart
Free
Free
Free
Free
Free
Free

Buy this video

Video

Access to the talk “Android Slices: build interactive results for Google Search”
Available
In cart
Free
Free
Free
Free
Free
Free

Conference Cast

With ConferenceCast.tv, you get access to our library of the world's best conference talks.

Conference Cast
558 conferences
22059 speakers
8245 hours of content