Duration 26:05
16+
Play
Video

Migrate your existing app to target Android Oreo and above

Fred Chung
Developer Platform Manager at Google
+ 2 speakers
  • Video
  • Table of contents
  • Video
2018 Google I/O
May 10, 2018, Mountain View, USA
2018 Google I/O
Video
Migrate your existing app to target Android Oreo and above
Available
In cart
Free
Free
Free
Free
Free
Free
Add to favorites
12.61 K
I like 0
I dislike 0
Available
In cart
Free
Free
Free
Free
Free
Free
  • Description
  • Transcript
  • Discussion

About speakers

Fred Chung
Developer Platform Manager at Google
Dan Galpin
Team Lead at Google
Eric Kuxhausen
Software Engineer at Google

Fred is with Developer Relations team at Google. He currently oversees various Android developer advocacy efforts in China. Previously, Fred has held product management roles in Firebase and Google Play services developer products focusing on helping emerging markets developers succeed.

View the profile

Dan Galpin leads the Android advocacy team. He has taken on many roles throughout his eight-year tenure at Google including the development of our Udacity courseware. Dan developed Android educational materials before starting at Google, and worked as a software engineer at companies such as Verisign and Motorola. He has a BS in Computer Engineering from the University of California, Santa Cruz.

View the profile

About the talk

Google Play will require app updates to target Android Oreo or above starting this year. This is a how-to guide for migrating an established app, looking at the important changes you need to consider targeting Android Jellybean onward.

Share

All right, welcome to migrating your Android app to Android Auto & Beyond. Hi, I'm Fred xiong developer Advocate Advocate. Hi, I'm Eric. Not a developer Advocate. I'm the lead software engineer responsible for my grade in the Google Play Store app to Target API 26 Thank you for joining us on the afternoon of the last day. This is where they scheduled the most anticipated sessions except for that funny improv one that we don't record. Sorry home viewers for what

is really the grand finale of Google IO. Well, let the grand finale begin but foremost in your mind, especially if you're just tripping on Google Play. What new app for the US by the end of this year in August 2018. You must be talking at least API level 26 or Android 810 likewise for app updates. They must also be turning at least API level 26 by November of 2018 that is if you wish to continue releasing a States going forward every new Android version introduces changes

that bring significant security and performance Improvement apply to ask that explicitly declared support through their target SDK version manifest attribute also known as the target ATI level. A friendly reminder like this. And I'm here because he wanted to keep updating the Play Store app on Google Play after the November deadline. Let's go over some Basics real quick. Everyone minimum SDK is the lowest platform version your app is willing to support

its Market penetration of various Android releases. Wireless Decay is literally the SDK headers and stuff library that your project links to an important. One. Of course is the one I'm talking about. The target SDK version is the Falcons way to ensure backwards compatibility. This means that you only have certain Behavior changes applied at certain specific Target SDK versions. So technically this needs to be true. This is so typical and recommended case since you

are probably care about 95% of users out there that I'm not quite targeting the latest versions of Android just yet. We are working to improve stats. So if you don't change your target SDK to at least version 26, you might not have to deal with things like runtime for emissions alarm manager changes coming up with different ways to handle broadcast receiver actions and avoiding background services, but there's a good chance the rapper to waste Network and battery will make him a device experience less fast and fluid So if you are migrating from a tree and version

one of the biggest changes is probably the support for run time for Missions run time for Missions are really about user privacy and Trust. What is also allow for apps to ask most sensitive permissions in contact and that's a good thing for apps because you don't want someone to not install your apps just because you are asking for permission for some sensitive information in one particular flow within your app. So first of all, you know, it's not all permissions are runtime ones Justice simple easy to remember list. But worry not developers

user season in terms of these broader category and the app really need supervision at all. After all removing. The information is easy now Eric. How did the Play Store app handle this simple? All you need to do is make sure that your app is free grant the permissions on the system image that being said we to try and use a few of these as possible. I have coarse just because your app isn't yet targeting M. It doesn't mean that your users can't go and disable any permissions. They don't want you to have

Enter a special commission stat, you need to redirect user to settings to obtain for example drawing overlay windows or there could be some procession permissions light screen capture. The work of the UI runtime for Missions actually require an activity or fragment that is overridden be on request permission result method know this music review. Larry life activities fragments need to enter information to actually required by the other layers. Alright, here's a great transition. Let's talk about alarms to basic forms. They

are literal alarms that allow an app itself up. It's delivered notification some real time event such as waking you up or an upcoming appointment or they are away of scheduling work happened it sometime in the future after the app is closed at the beginning of the of Android. This was a single ATI. But that KitKat we made alarm manager not exact unless it was explicitly requested that which makes it better for scheduling future work. Now if we added the method set exact and here's where we support library to call it on KitKat in the Box.

We don't use any exact alarms in the Play Store app the alarms we do use or inexact which allows the system to batch them for better battery and system health. No Android marshmallow added Jose weasel out Android to go idle when alarms would normally fire. So we added the obvious method exact and allow while idle to allow arms to wake the device from Joe and we support life for that as well and knows that it actually calls the previous Court Library method exact on earlier platform versions. So after all that expectation, does it take a

pretty simple right job at work Manager work manager of the new work schedule and saying that we launched a part of Jetpack and it's an asstate and when it becomes stable, it will be the recommended API for running tasks unless we come up with something better before then. Play Store was able to see art background task regularly reach 2% more users on KitKat. When we adopted Firebase jobs dispatcher rather than just using alarms this improve system Health battery usage. If you

do have to use alarms use the Alise exact ones, you can only be used every 15 minutes or so, so you should only be using those to viciously Oh, yeah work manager. So let's talk again about broadcast. I know that right that's used by the platform to notify and launch apps in response to system with white events. It's one of the reasons that Angela has such a powerful API service with great power comes great responsibility and it has been used. Most of these

can no longer launch your app at least once you are ghetto. Well, there are exceptions. Of course, it's Android, right? Many of these headphones very rarely such as changes in low-cal just yet to the broadcast for the apps that need them for example, you know like those USB accessory ones. That's checking example on how to avoid using broadcast. There's a job, right? You can't do so by setting up the proper execution criteria such as requiring network service and then we can have something that's comfortable

to listening to network State change broadcast. And if you do have cold like this in your manifest in order on older versions of Android you can is able to connect to the connectivity change and I'll just leave it disabled. And then what are you going to do? Are you can dance and able to receiver by setting the component enable setting in the package manager? Another exception is if you need to perform any task after your package has been updated for example of rescheduling alarms or updating your database. You can still register receiver in your

manifest for the action my package replaced but continues to work because it's one of the explicit broadcast Target adjust to your app. Now if you really need to do some work in every package update and probably don't guess you can no longer be launched by Action Packers replace events, but we do have an API called get changed packages to see what packages of changed since the previous save sequence number. Now in life running is usually healthy. I probably should do more but Android app wants to run those little as possible and lazy after actually better ass

and Fred. You know, what are you saying that we should actually sounds good to me. Let's talk about what it means to be in the foreground. Because he's not completely obvious right? There are some typical cases like when your app is visible to users or when you're using foreground service or if you're at is found to a foreground app. So your app is also in the foreground in these exceptional cases. Your app is in the background when you're not visible when it's running a standard

service job service or broadcast receiver. And when you're on O+ starting service when running in the background group throw an exception caught in Edo State exception, which is not good. Now you can start Services when your app is in the foreground and continue to run for about a minute after I pass background it important because on on system releases anyway clocks that you're assholes when you have no Active Components such as this applies to all apps not just as targeting a hoe. There are a few cases where you're at is still allowed to

run if it's for ground and start services, for example in response to notification action a high priority by bass Cloud message to MMS or SMS delivery. So let's talk to you at some solutions for running in the background without background services. First of all used ECM fire a job for background tasks are very many. Good reasons for this many Android version. For example, if you don't care as much about having your app, behave consistently across platforms.

I want to move to with the least amount of work required. You can also use job in temp service seriously consider using work manager strains and make your life easier. So the Google Play Store app didn't have the luxury of using work manager because it didn't exist yet that meant we had to use job scheduler and Firebase jobs dispatcher. Now. The first thing we learned is not to use jobscheduler on Android L. Unless you really understand how it behaves and have alarm Watch Dogs when it doesn't behave as expected. Also use work around for example on

L and the first release of him job scheduler won't actually run two jobs that unless will actually run your job unless they're two jobs with the same constraints met you can work around this by scheduling two jobs with matching constraints. Things to get much better for job scheduler on MMR 1 and above however, another is that you should avoid calling set minute late and C20 is can interfere with override deadline on some releases. The overnight deadline is a way of making sure that your job runs the sticks. Of time, even

if the constraints aren't met you could just use work manager, which doesn't actually have override deadlines. But what you should do is schedule a second job as Watchdog performance similar function. Are a few things to consider when using job scheduler or work manager Android tries to detect have two photo and poor Network conditions, but it's an imperfect art in addition occasionally. Wake up your app, right before network is available deer out all this means is that you'd have proper error handling to ensure rescheduling of jobs in Play store added exponential back-off

to our jobs. We saw a 19% more successful back on tap. The key here though is let the system do its work is easy to make a mistake of rescheduling with a same job ID while also using system back off. It's going to interfere or even reset the back off right or with work manager. Actually. Yeah, I don't do that either cuz it'll have the same results. So we're apis that require that you use pending intense. You can change the penny in 10 targets from a service to a broadcast

receiver execute within 30 seconds and then call go a sink and run your work right within the broadcast receiver, which way is the super lightweight way of getting something done note that you aren't guaranteed to have that work for weight loss. So there was too many cases where you should a job within your broadcast receiver using upwork manager. If you have external a trigger a time-sensitive events that require immediate use our attention consider using Firebase Cloud messaging to notify your at a standstill points high and

normal priority messaging for high-priority messages. Wick is it'll wake the device from Jose which means that a lot of them won't be a good thing for a system help. If the task and run with less within less than 10 seconds or so, you can execute it right away as schedule a job with work manager. They're actually cases when foreground services are desired or required user-initiated tasks that run for a long time and want to splice sensitive content update to the user examples are maps navigation Fitness tracking Play Music

and play storm is a foregone service when we restore apps after device setup. Is it? Okay because its long-running work in response to user interaction, but it's not as fun as listening to music. The good news is that these other things already impacting your apps, but perhaps you haven't noticed yet. bat stop in Android n a new phone new photo broadcast no longer happen. All right, but can be replaced by trigger contact you all rights. What jobs I mean work. That is what it looks like

using then your work manager API. Now if your app is running in the background on an Android O+ device the location system service confuse a new location for your app less often, even if your app request more frequent updates, even for Wi-Fi scans are only performed for background apps a few times every hour you're so you're called more often does wife actually just provide cash results. Avista when user reaches a specific location use geofencing Now there are only 100 geofences. It can be active. So if you need more sites now, you can actually use Regional geofences to swap in

and out of different offenses is needed. I said no beacons are awesome. You can use the nearby notifications API and that's particularly if you're a certain political coffee Bender. You can also use the bats version of the fuse location provider specify a maximum location update wait time. It is acceptable for use case and the system will attempt to attempt to batch location updates. So that your app is woken up less frequently. It's a lot size battery use You can also use passive location that Abel's enables your app to opportunistically piggyback on

other apps location updates on to this fastest interval specified. He didn't mind them. But if your application updates are tied to any expense of operations such as Network calls, you spell throttle those as well. So through batching and look passive location weekend work with location updates in a power efficient manner next in the platform. Turn in the past several releases of Android we've introduced a series of battery optimization features that are based on deferring and restricting background tabs. So you probably are family

with some of these are ready. For example, a device with antidotos where the device when a device is unplugged and when a device isn't being used for quite some time and don't have to finish any pending jobs in some periodic maintenance windows on a device is sitting in the pocket. Now stand by was introduced in have more it exposes imposes taxes and let me tell you about the brand new stuff and Android P usage face restrictions applied in a more fine grain way you may have already learned about this in the earlier. I O talk don't let your app. Grindr users Battery apps will be added to one of

the app standby buckets based on usage system applies progressively more restrictions to Europe as it goes from the active for the rear bucket. Additionally battery saver is enhanced in team. It allows users to have extended battery life by prioritizing battery over everything else is leads to some degradation and functionality such as location not available when the screen is off the last just a bit longer. The beach house that we just discussed have additive impact on an apt alarm Job saying network access and fcm messages.

So we really encourage everyone to thoroughly test the scenarios with in your applications and a good news for that. The test app standby for stimulate unplugging the device and then you can use the gate and set an active command if the device in and out of that stand by. Perhaps stand by you can get and set buckets for a given package using similarity commands, but remember before testing apis available to do that. Finally read these are the commands for testing battery saver OneNote is that if your apps UI has the dark game, you can go see her and they belong to talk to you when battery

savers turned onto brother concert power on all devices how a manager you can check with an API and listen to a broadcast to do that. So there are lots of ways to make your ass to cool stuff in the background without using for ground Services leverage the new functionality in work manager use the new apis and make sure to tell us what doesn't meet your needs if I submitting feedback for the issue tracker. . Right after this talk you'll probably be busy updating your tablet sdks, which is all good to check out some selected

modern features on Android that irrelevant you are use cases. So you have your at work sample notification Channel history rap on other wise. Well notifications just won't show which won't be good just cancel actively turn off notifications that they don't want. Back one slide, please devices where the Play Store implemented support for notification channels. We see a few or percentage of users to saving all of our notifications. So if your app is using a translucent status bar and you

can use the inside apis to make sure that your code doesn't assume that the status bar is a fixed size and is if you're actually really common nephew Target T. You can also do something interesting that cut out area now public service announcement. You don't have to put your system image on your only device. If you have a pretty awesome recently, we've added support for super fast loading along with ar support on any device with the p developer preview system. You can simulate display cut out for the developer options. break, so

long aspect ratio screen has to be shipping devices like these with screens larger than 16 by 9 aspect ratio, which immersive experiences can fully take advantage of these screen capabilities, which is pretty awesome way to declare your maximum supported aspect ratio, but it it was display a letter box around your application. And seriously. Do you really want letter boxes? With bigger screen comes more responsibility now consider taking advantage of picture-in-picture for use cases such as video chat movie Playback fitness-tracking or Pokemon go.

Multi-display support multiple attitude that user to launch an activity figure application on a second display. So be careful not to make application wide assumptions about Hardware configuration. And in conclusion Android development has evolved to enable better battery life and taking advantage of Jetpack to build a modern testable architecture. Thank you. Alright, actually no no, no, no and I think we're actually a warranty with like toasted login Teresa's he's message message for used but he'll notice that you're testing against dp2 some of these messages. We'll just see to work and will cause

your after crash. So will you test a file issues if you don't think there's any way your acting work other than these methods and help you out in the future. We've actually added a new BM policy that you can use to turn on and attacked all non SDK API usage which is really important cuz it's not a c k usage may actually be happening in your libraries. So this is a really great way to actually to make sure that your ass is going to be compatible going forward. We don't guarantee the compatibility of any non SDK API And that really is it now if you

haven't paying attention in the last 30 minutes, that's okay because clearly my jokes need work. If your engineer hopefully much of the information shared today was a review for you and we hope you found that it's useful. So if you have p.m. And it is not quite yet not too late to plan things out workers at change to figure out you know, how much work is needed. And in fact on Android development sites to help you understand, you know that based on your current release the amount of work needed so that we can collectively push the ecosystem for thank you very much.

Cackle comments for the website

Buy this talk

Access to the talk “Migrate your existing app to target Android Oreo and above”
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

Madan Ankapura
Product Manager at Google
+ 2 speakers
Benjamin Poiesz
Software Engineer at Google
+ 2 speakers
James Smith
Software Engineer at Google
+ 2 speakers
Available
In cart
Free
Free
Free
Free
Free
Free
Sumir Kataria
Software Engineer at Google
Available
In cart
Free
Free
Free
Free
Free
Free
Jonathan Gerrish
Software Engineer at Google
+ 1 speaker
Stefan Ramsauer
Software Engineer at Google
+ 1 speaker
Available
In cart
Free
Free
Free
Free
Free
Free

Buy this video

Video

Access to the talk “Migrate your existing app to target Android Oreo and above”
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