Slide 1

Slide 1 text

What’s new in Android 10 A developer’s preview

Slide 2

Slide 2 text

About Me Engineering Lead, Mobile Platform Team Zomato Co-Founder & Mentor Coding Blocks

Slide 3

Slide 3 text

Android 10 September 3, 2019 First numerical Android release, without any desert names. Originally called Android Q

Slide 4

Slide 4 text

Highlights for users

Slide 5

Slide 5 text

Smart Reply Auto suggestions to reply to texting apps, powered by the engine that supports smart suggestions on Gmail

Slide 6

Slide 6 text

Sound Amplifier Native support for in- built amplifier and equaliser.

Slide 7

Slide 7 text

Gesture Navigation New gestures to go home and to go back with smooth animations

Slide 8

Slide 8 text

Live Captions Machine Learning powered live captioning of any video you are watching, even it did not have subtitles.

Slide 9

Slide 9 text

Foldable UI Support for multiple different size screens and foldable devices

Slide 10

Slide 10 text

Dark Mode New dark mode support, for most apps, helps reduce battery drain on OLED phones.

Slide 11

Slide 11 text

Digital Wellbeing Check app usage, turn on focus mode to disable distracting apps, mute notifications.

Slide 12

Slide 12 text

What has changed for app developers ?

Slide 13

Slide 13 text

Privacy Android 10 has a focus on improving users’ privacy, which means apps must adapt to new restrictions ● Scoped Storage ● Foreground-only location ● Background execution limits ● Access to unique ids like IMEI ● Wifi/BT scanning

Slide 14

Slide 14 text

Scoped Storage ● Android 10 doesn’t allow apps to access entire SD Card ○ Used “scopes” like PICTURES, MUSIC, MOVIES etc ○ Apps can only see files within a scope ● File Managers, as we know them, might cease to exist ● Legacy support, for the time being ○ requestLegacyExternalStorage in Android Manifest

Slide 15

Slide 15 text

Background location ● New permission ACCESS_BACKGROUND_LOCATION ● For older apps, OS automatically adds permission if FINE/COARSE location requested. ● Must be explicitly added for targetSdk = 29 ● Without this permission, location works only in activities and foreground services

Slide 16

Slide 16 text

App upgrade location permission table

Slide 17

Slide 17 text

Unique identifier data masking in Android 10

Slide 18

Slide 18 text

Restrictions on scanning and metadata

Slide 19

Slide 19 text

Restrictions on background start ● Old way ○ Send intent with FLAG_ACTIVITY_NEW_TASK from service to start activity. ● New Way ○ Display time sensitive notifications with pending intent to activity ○ User can swipe away notification, or click it – which opens activity. ○ Even time-sensitive notifications are subject to DND rules. ● Exceptions ○ If app already is in foreground, or has a recent task open. ○ App is device policy manager.

Slide 20

Slide 20 text

Foreground Service Types

Slide 21

Slide 21 text

Clipboard Data Limitations ● You cannot access clipboard via ClipboardManager ● Only app that is currently default set IME (keyboard) has access to last clips on clipboard. ● Users can only explicitly paste data into your app

Slide 22

Slide 22 text

Reading IMEI / MAC ● Only apps with READ_PRIVILEGED_PHONE_STATE can read IMEI ● Submitting apps with READ_PRIVILEGED_PHONE_STATE to Play Store not allowed. ● Device Admin apps, and apps with carrier permissions (SIM card apps) can still access ● MAC address is now randomized. Device Admin apps can still read actual MAC address.

Slide 23

Slide 23 text

Toggling WiFi and reading saved networks ● Your app cannot toggle WiFi ○ WifiManager.setWifiEnabled() returns false always ● To nudge the user to turn on Wifi, send him to Settings app or use a Setttings panel (more on this later). ● Apps cannot read any information about saved networks, nor can they connect/reconnect/disable/forget saved networks.

Slide 24

Slide 24 text

Physical Activity Recognition ● To read step counter and step detector, new permission needed ○ ACTIVITY_RECOGNITION ● Accessing data indirectly from apps like Google Fit will also need the same permission

Slide 25

Slide 25 text

What’s new for developers

Slide 26

Slide 26 text

Biometric Prompt § A new BiometricManager with BiometricPrompt § Check if device has biometrics § Available via androidx.biometric support library. § Supports face, fingerprint, IRIS and other mechanisms

Slide 27

Slide 27 text

Showing BiometricPrompt and handling callback

Slide 28

Slide 28 text

Wifi Suggestion API

Slide 29

Slide 29 text

New Wifi P2P Connection Mechanism (lot less code)

Slide 30

Slide 30 text

Audio Input Sharing ● Earlier only one app could read an audio source ● From Android 10, multiple apps can plug into the same audio source. ● Easier to make apps like call-recorder.

Slide 31

Slide 31 text

Notification Seekbar § Media notifications can have seekbar § Useful for Music apps § Can be display-only, or also drag-to-seek

Slide 32

Slide 32 text

Dynamic Depth Format Use depth information in a new open dynamic depth format. Apps can use that information to post process (add/remove bokeh) from the photos.

Slide 33

Slide 33 text

HEIC support ● High efficiency image file/codec (HEIF/HEIC) support ● All Android 10 devices can record video in HEIC ● All Android 10 devices can seamlessly and transparently read HEIC files.

Slide 34

Slide 34 text

Settings Panels § A new API to show a popup to users to toggle certain settings. § Android 10 doesn’t allow apps to directly change BT, Wifi etc states. § Apps can nudge a user by showing a settings panel.

Slide 35

Slide 35 text

Open Settings Panel (really easy one-liner)

Slide 36

Slide 36 text

Sharing Shortcuts API § Android Direct Share API is really old, and had become very slow if multiple apps installed. § It used to query all sharing intents at runtime and the dialog would take time. § Sharing Shortcuts API makes it much faster.

Slide 37

Slide 37 text

Register Sharing Shortcuts in Manifest

Slide 38

Slide 38 text

Android OS improvements § ART performance has improved. § On-Device TensorFlow support is better with Neural Networks API 1.2 § Thermal API for apps to check device heat-up and mitigate it.

Slide 39

Slide 39 text

Supporting Android 10

Slide 40

Slide 40 text

Step 1 ● Make sure your current app works on Android 10 ● Get an Android 10 emulator or Android 10 device (Oneplus/Pixel for now) ● Check everything works on your app

Slide 41

Slide 41 text

Step 2 ● Set compileSdk to 29 and targetSdk to 29 ● Make changes as per new APIs ● Build app and check new and changed features. ● Release update.

Slide 42

Slide 42 text

One more thing

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Thank You! Any questions ? twitter - @championswimmer github – championswimmer speakerdeck.com/championswimm er email: [email protected]