Migrate your app to Android N - what will work OOTB, and what will suddenly break your app. UA...

Post on 07-Apr-2017

194 views 0 download

Transcript of Migrate your app to Android N - what will work OOTB, and what will suddenly break your app. UA...

What’s new in Android

Mateusz Herych

Android @ IG

Mateusz Herych

Android @ IG

Fresh dad of twins

Mateusz Herych

Android @ IG

Fresh dad of twins

Full time

Mateusz Herych

Android @ IG

Fresh dad of twins

Full time

4x fulltime

Mateusz Herych

Android @ IG

Fresh dad of twins

Android GDE program member

Mateusz Herych

Android @ IG

Fresh dad of twins

Android GDE program member

GDG Kraków co-org

What’s new in Android

Android N developer preview

Android N developer preview

N is for ...

What cool features is N coming with?

What cool features is N coming with?

How Android N will break my app?

Why should I care (now)?

Lollipop is over 40% now

Nexus is not just a developer-candy anymore

Multi window support

Multi window support

Was there in 6.0 (Marshmallow) preview, then removed before release.

Enabled for every app by default (even for non-N-targetting)

Enabled for every app by default (even for non-N-targetting)

Lifecycle - only most recent Activity is in resumed state.

Enabled for every app by default (even for non-N-targetting)

Lifecycle - only most recent Activity is in resumed state.

Lifecycle - split and resize works same as orientation / configuration change

Enabled for every app by default (even for non-N-targetting)

Lifecycle - only most recent Activity is in resumed state.

Lifecycle - split and resize works same as orientation / configuration change

You can specify a minimum height / width

Two screens at most

Two screens at most

One above another or side-by-side

Two screens at most

One above another or side-by-side

Drag’n’drop between two screens

How can I know it’ll work?

How can I know it’ll work?

Install N on your phone / run emulator.

How can I know it’ll work?

Install N on your phone / run emulator.

“Don’t keep activities” in settings

How can I know it’ll work?

Install N on your phone / run emulator.

“Don’t keep activities” in settings

Orientation changes

How can I know it’ll work?

Install N on your phone / run emulator.

“Don’t keep activities” in settings

Orientation changes

Consider your onPause()

Btw

screenOrientation=”portrait”, anyone?

Btw

Isn’t going to work in N.

Btw

Isn’t going to work in N. (unless you disable multi-window support for your app)

Btw

Same case if your app is hiding a status bar.

Yes, you can disable it entirely for your app.

android:resizeableActivity=["true" | "false"]

But, please.

Don’t.

Another cool feature that makes Android better.

Future?

Maybe.

Doze - Marshmallow

Doze - Marshmallow

Screen is off

Doze - Marshmallow

Screen is off

Not charging

Doze - Marshmallow

Screen is off

Not charging

Device is stationary

Doze - N

Screen is off

Not charging

Device is stationary

Doze - N

Screen is off

Not charging

Device is stationary

Broadcast Receivers

Broadcast Receivers

How much time does it take to shoot a picture on your Android device?

Broadcast Receivers

How much time does it take to shoot a picture on your Android device?

How your devices behaves (performance) when your device connects to a WIFI network?

Broadcast Receivers

CONNECTIVITY_ACTION

ACTION_NEW_PICTURE

ACTION_NEW_VIDEO

Broadcast Receivers

AndroidManifest.xml won’t work for them

Broadcast Receivers

AndroidManifest.xml won’t work for them

Only for foreground apps, with Receivers registered on a main thread

Broadcast Receivers

Even for targetSdk < N

Broadcast Receivers

Don’t listen on CONNECTIVITY_ACTION

Broadcast Receivers

JobScheduler / GCMNetworkManager

Metered plans

Metered plans

How much would you pay for 1 GB of data plan in a foreign country?

Metered plans

1 GB = ?

Metered plans

1 GB = ~2500 EUR

Data saver

Data saver

ConnectivityManager.isActiveNetworkMetered()

Data saver

ConnectivityManager.isActiveNetworkMetered()

(API Level 16)

Data saver

Settings -> “Restrict data consumption in the background”

Data saver

Your app can be now whitelisted. Yeah!

Data saver

ConnectivityManager.getRestrictBackgroundStatus()

Data saver

RESTRICT_BACKGROUND_STATUS_DISABLED

RESTRICT_BACKGROUND_STATUS_ENABLED

RESTRICT_BACKGROUND_STATUS_WHITELISTED

There are more

There are moreJava 8 support (finally, but!)

There are moreJava 8 support (finally, but!)

New notifications (built-in new support lib, Notification.Builder)

Questions?

Curry onand #minSdkLevel19