RICH HYNDMAN: Android Marshmallow
is coming to devices soon.
And just like every new Android release,
it's important to make sure that your app is up to date
and ready to be installed as soon as the upgrade rolls out.
My name is Rich Hyndman, and I'm here
with a quick update to using the developer preview to get ready
for launch.
Let's jump right in.
The Android M developer preview three
consists of the final Android 6 SDK.
It's got documentation, sample code, and near-final emulator
and device images.
We've incremented the API level to 23 now,
so you can upload your Marshmallow targeted apps
to the Play Store and make use of the alpha and beta channels.
If you've been following along through dev previews
one and two, then this update is pretty incremental.
We've enhanced the permissions, user interface and behavior
and also updated the fingerprint API to give a better enrollment
experience, enumeration support, and improved error reporting.
You can check the API differences
doc for full details.
If you've not already flashed a device to the developer
preview, then it's worth pointing out
that you should grab the latest SDK first.
Open up Android Studio.
There's no need for preview or Canary channels this time
as we're on the final SDK so head straight into your SDK
manager.
You have access to the final Android 6 APIs and the latest
build tools so you can target API 23.
Whilst you're there, you should update to the new Android
support library as well.
It contains a number of new support libraries,
including custom tabs, percentage-based measurements,
recommendation, and preferences.
And you're all ready to go.
If you're starting a new project,
you can choose target SDK API 23 and ignore
the fact it says Android 5.x.
We'll fix that before the actual release.
If you're updating an existing developer preview project,
you're now switching your build from using Android
MNC as your SDK version to 23.
You can also head to the AVD manager
if you want to set up an emulator.
Select a device of your choice and use the API 23 x86 images
for best performance.
OK, back to the device images.
So ensure your data's backed up and follow the steps
in the preview guide.
If your Bootloader is locked, then you'll
have to unlock it first.
So ensure, if you're on a Nexus 6 or a Nexus 9,
that OEM unlocking is enabled in the developer options.
Then ADB to reboot into Bootloader,
run fastboot OEM Unlock, which is also
going to wipe your data.
Then you're going to go to the system images
and execute the flash-all script.
It's going to update your device's Bootloader, baseband,
firmware, and OS.
Then to be secure, it's recommended
to lock your Bootloader again with fastboot OEM lock.
It should be smooth sailing.
And if you do hit a missing system.image error,
then you're probably not using the latest SDK tools.
Now you have an Android M device for testing and a preview
emulator.
As always with new releases, we have some changes in behavior
that you'll need to test out.
You can find them all on the Behavior Changes
page on the preview site.
First up, a deprecated API that's been removed.
If your app or any of the libraries you use
rely on the Apache HTTP client, you're
going to need to make a small update to include it
in your build and declare it as a compile time dependency
in your build.gradle file.
If your app targets Android 2.3 or higher,
I would highly recommend switching
to the more efficient HTTP URL connection class instead.
Next up, we have Doze.
If a user leaves a device unplugged and stationary
for a short period of time with the screen off,
the device is going to enter Doze mode.
It's going to try and stay asleep
until the device is disturbed.
Restrictions will apply to your app in this mode.
Wake locks are ignored, sync adapters can't sync,
scheduled alarms are deferred, and network access is disabled.
You can enable some of these, so check the documentation
on power-saving optimizations for more details.
To test Doze mode, we have ADB commands here.
There's also App Standby mode, which can detect and affect
inactive apps.
So check that out as well.
Excitingly, runtime permissions are here.
They provide less friction on install and automatic app
updates.
But you can no longer assume that just because your app is
installed all its stated permissions have been granted.
Permissions are granted at runtime,
and users can revoke permissions on a per-app basis at any time,
even for legacy apps that aren't targeting Android M.
For testing, we have more all-new ADB commands
for parameters for granting permissions, revoking
permissions, installing apps with all
the permissions granted.
Check out the Permissions Guide on the preview
site for details.
Always check that you have a permission before trying to use
it and request it if you don't.
If there's a set of permissions that your app needs,
like camera access for a camera app,
it can be worth requesting them in a warm welcome upfront.
Next, Android Auto Backup.
It's a new service designed to simplify building a robust data
backup service for developers and improve the lives of users.
Up to 25 megabytes of data is backed up per app.
Watch Matthew's video for full details.
If your project targets them, backup
will be automatically enabled, and there
were a couple of things you should be aware of.
If you have any data you don't want backed up,
like device-specific or encrypted data,
then the easiest thing to do is move it
into the Get No Backup Files directory.
You can also specify an inclusive or exclusive
backup scheme or opt out altogether.
For testing, there are new ADB Shell backup manager commands.
And as I say in the M preview build,
Auto Backup is enabled for all apps.
For the M release, we will only do it
for apps that are targeted M or higher.
It's also worth mentioning that for testing we
have new fingerprint APIs and the new ADB Finger Touch
command to go along for simulating fingerprint input.
Check the preview site and [? Maya's ?] video
for full details.
So, we're on preview three.
We're on the home straight to the final release.
So please ensure your apps are ready.
Check out the preview for other features
like app standby, adoptable storage, data binding, text
selection, and the very powerful app linking.
Test now while you have time, and you can give us feedback
in the Android M developer community on Google+.
So that's Android Marshmallow, something harmless
and lovable that could never possibly run amok in New York
and destroy us.