Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What is new in Android 10 - A developer preview

Arnav Gupta
October 06, 2019

What is new in Android 10 - A developer preview

A run through of new APIs and features and deprecations in Android from a developer's standpoint.

Arnav Gupta

October 06, 2019
Tweet

More Decks by Arnav Gupta

Other Decks in Technology

Transcript

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

    View Slide

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

    View Slide

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

    View Slide

  4. Highlights
    for users

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  9. Foldable UI
    Support for multiple
    different size screens
    and foldable devices

    View Slide

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

    View Slide

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

    View Slide

  12. What has changed
    for app developers ?

    View Slide

  13. 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

    View Slide

  14. 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

    View Slide

  15. 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

    View Slide

  16. App upgrade location permission table

    View Slide

  17. Unique identifier data masking in Android 10

    View Slide

  18. Restrictions on scanning and metadata

    View Slide

  19. 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.

    View Slide

  20. Foreground Service Types

    View Slide

  21. 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

    View Slide

  22. 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.

    View Slide

  23. 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.

    View Slide

  24. 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

    View Slide

  25. What’s new
    for developers

    View Slide

  26. 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

    View Slide

  27. Showing BiometricPrompt and handling callback

    View Slide

  28. Wifi Suggestion API

    View Slide

  29. New Wifi P2P Connection Mechanism (lot less code)

    View Slide

  30. 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.

    View Slide

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

    View Slide

  32. 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.

    View Slide

  33. 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.

    View Slide

  34. 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.

    View Slide

  35. Open Settings Panel (really easy one-liner)

    View Slide

  36. 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.

    View Slide

  37. Register Sharing Shortcuts in Manifest

    View Slide

  38. 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.

    View Slide

  39. Supporting
    Android 10

    View Slide

  40. 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

    View Slide

  41. 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.

    View Slide

  42. One more thing

    View Slide

  43. View Slide

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

    View Slide