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

IO/Extended Yangon 2022 - What's new in Android?

IO/Extended Yangon 2022 - What's new in Android?

0991ca4bc363163337f7b02b98af538a?s=128

Aung Kyaw Paing

May 21, 2022
Tweet

More Decks by Aung Kyaw Paing

Other Decks in Technology

Transcript

  1. Aung Kyaw Paing What’s new in Android? Android 13, AS

    Electric Eel, Privacy Sandbox and much more
  2. Tiramisu Android 13

  3. User now has a choice to make app icons inherit

    the theme color Themed App Icons
  4. Developer has to provide a monochromatic app icons. Themed App

    Icons
  5. Built in photo pickers in OS. Using this picker doesn’t

    require READ_STORAGE permission. Photo Picker
  6. photo_picker.kt //If version > 13 val intent = Intent(MediaStore.ACTION_PICK_IMAGES) //Setup

    picker config //Launch Picker startActivityForResult(intent, PHOTO_PICKER_REQUEST_CODE)
  7. photo_picker.kt //If version > 13 val intent = Intent(MediaStore.ACTION_PICK_IMAGES) //Setup

    max count int maxCount = 5; intent.putExtra(MediaStore.EXTRA_PICK_IMAGES_MAX, maxCount) //Launch Picker startActivityForResult(intent, PHOTO_PICKER_REQUEST_CODE)
  8. photo_picker.kt //If version > 13 val intent = Intent(MediaStore.ACTION_PICK_IMAGES) //Setup

    max count int maxCount = 5; intent.putExtra(MediaStore.EXTRA_PICK_IMAGES_MAX, maxCount) //Set to video only intent.type = "video/*" //Launch Picker startActivityForResult(intent, PHOTO_PICKER_REQUEST_CODE)
  9. photo_picker.kt override fun onActivityResult(...) { //if result ok when (requestCode)

    { REQUEST_PHOTO_PICKER_SINGLE_SELECT -> { val currentUri: Uri = data.data // Do stuff with the photo/video URI. } REQUEST_PHOTO_PICKER_MULTI_SELECT -> { // Get photo picker response for multi select. data.clipData.forEach { clipData -> val uri = clipData.uri // Do stuff with the photo/video URI. } } } }
  10. photo_picker.kt override fun onActivityResult(...) { //if result ok when (requestCode)

    { REQUEST_PHOTO_PICKER_SINGLE_SELECT -> { val currentUri: Uri = data.data // Do stuff with the photo/video URI. } REQUEST_PHOTO_PICKER_MULTI_SELECT -> { // Get photo picker response for multi select. data.clipData.forEach { clipData -> val uri = clipData.uri // Do stuff with the photo/video URI. } } } }
  11. photo_picker.kt override fun onActivityResult(...) { //if result ok when (requestCode)

    { REQUEST_PHOTO_PICKER_SINGLE_SELECT -> { val currentUri: Uri = data.data // Do stuff with the photo/video URI. } REQUEST_PHOTO_PICKER_MULTI_SELECT -> { // Get photo picker response for multi select. data.clipData.forEach { clipData -> val uri = clipData.uri // Do stuff with the photo/video URI. } } } }
  12. User can select a different language for different apps and

    won’t always be tied to system language. App-specific locale
  13. language_pref.kt val localeList = AppCompatDelegate.getApplicationLocales() //Show custom picker with locale

    list //Set selected locale val appLocale: LocaleListCompat = LocaleListCompat.forLanguageTags("xx-YY") AppCompatDelegate.setApplicationLocales(appLocale)
  14. Notification will be opted-out by default. Apps need to request

    permission to send notification Notification Permission
  15. Notification Permission

  16. On newly installed app If the app targets Android 13

    - MUST ask permission explicitly If the apps targets Android 12 and lower - System will ask permission when first notification channel is created. Notification Permission
  17. On existing app A temporary grant is given if user

    has enabled notification before and has existing notification channel. If the app targets Android 13 - The grant lasts until user launches the app If the apps targets Android 12 and lower - The grant lasts until user select an option from permission prompt Notification Permission
  18. User can see all foreground services running under active app

    list in notification drawer Foreground Service Manager
  19. Foreground Service Manager Getting killed by FGS Manager does not

    kill your scheduled jobs and alarms. The system will alert user to interact with your active task if it runs for more than 20 hours in a day.
  20. Other changes “Restricted” bucket changes “NEARBY_WIFI_DEVICE” permission added Body sensor

    background permission added Quick Settings placement API Revoke permission API BLE Audio support MIDI 2.0 Color vector fonts
  21. A new privacy standard Privacy Sandbox

  22. A new privacy standard that allow users info to be

    private. Currently in design proposal stage Privacy Sandbox
  23. Benchmark, Media3, Room, WorkManager Jetpack

  24. Kotlin Symbol Processor (Support) Rewritten in Kotlin Paging3 Support Room

    2.5
  25. room_multimap.kt @Query("SELECT * FROM Artist JOIN Song ON Artist.artistName =

    Song.songArtistName") fun getArtistToSongs(): Map<Artist, List<Song>>
  26. Support for Rx And Guava Improve handling of invalid/valid state

    More callbacks Paging
  27. Jetpack compose support Multiple backstack support Two-pane layouts support for

    large screens Rewritten in Kotlin Navigation
  28. Stable release. Library to persist preferences locally DataStore

  29. Track and analyze performance problems in your UI. Support up

    to API Level 16. JankStats
  30. Create profiles for your app that populate ahead of time

    compilation traces to reduce startup time and janks. Baseline Profile
  31. Measures app startup and scrolling performance, locally and in CI.

    Macrobenchmark
  32. Write trace events to system trace buffer Tracing

  33. Supports new multiple form factors and multi-window devices. WindowManger

  34. Accepts drag and drop data easily DragAndDrop

  35. Emoji2 supports for latest emoji App-specific locale support from Android

    13 Play Splits to download additional locale AppCompat
  36. ExoPlayer3 Media3 Others

  37. Now with easier multi factor support! Jetpack Compose

  38. Font Padding Text Magnifier Downloadable fonts Text Improvements

  39. font_padding.kt Text( text = myText, style = TextStyle( lineHeight =

    2.5.em, platformStyle = PlatformTextStyle( includeFontPadding = false ), lineHeightStyle = LineHeightStyle( alignment = Alignment.Center, trim = Trim.None ) ) ) Set to true (left) and false (right)
  40. Text Magnifier

  41. downloadable_font.kt @OptIn(ExperimentalTextApi::class) val provider = GoogleFont.Provider( providerAuthority = "com.google.android.gms.fonts", providerPackage

    = "com.google.android.gms", certificates = R.array.com_google_android_gms_fonts_certs ) val fontName = GoogleFont(“Lobster Two”) val fontFamily = FontFamily( Font(googleFont = GoogleFont(name), fontProvider = provider) )
  42. downloadable_font.kt @OptIn(ExperimentalTextApi::class) val provider = GoogleFont.Provider( providerAuthority = "com.google.android.gms.fonts", providerPackage

    = "com.google.android.gms", certificates = R.array.com_google_android_gms_fonts_certs ) val fontName = GoogleFont(“Lobster Two”) val fontFamily = FontFamily( Font(googleFont = GoogleFont(name), fontProvider = provider) )
  43. downloadable_font.kt val fontFamily = FontFamily( Font(googleFont = GoogleFont(name), fontProvider =

    provider, weight = weight = FontWeight.Bold, style = FontStyle.Italic) )
  44. Lazy Grids Window Insets Window sizes Support for Wear OS

    Layout Improvements
  45. Tooling improvements

  46. Animation Preview

  47. Multipreview

  48. Recomposition count

  49. Live Edit

  50. A new code sample repo that showcase Modern Android Development

    See: https://github.com/android/nowinandroid
  51. A brand new API for health data Health Connect API

  52. Centralized permissions, data management and storage for users and developers.

    Health Connect
  53. write_data.kt suspend fun insertSteps(healthConnectClient: HealthConnectClient) { val records = listOf(

    Steps( count = 120, startTime = START_TIME, endTime = END_TIME, startZoneOffset = START_ZONE_OFFSET, endZoneOffset = END_ZONE_OFFSET, ) ) val response = healthConnectClient.insertRecords(records) }
  54. read_data.kt suspend fun readDataRange(client: HealthConnectClient) { val response = client.readRecords(

    ReadRecordsRequest( recordType = Steps::class, timeRangeFilter = TimeRangeFilter.between(START_TIME, END_TIME), ) ) response.records.forEach { // Process each entry } }
  55. Electric Eel is here to shock you Android Studio

  56. View data from Google Play SDK index and provides lint

    checks if a SDK is outdated. SDK Insight
  57. Highlight codes that have relevant crash data. See stack traces,

    statistic, and link out to Crashlytics dashboard easily. Crashlytics
  58. New Logcat will be enabled by default New Logcat

  59. Add ability to resize emulator and supports for bluetooth emulation.

    Emulator
  60. You can now mirror connected devices and control from IDE.

    Device mirror
  61. SDK Index, Data Safety Play Store

  62. Data Safety Provides information for users on what data you

    collect and why. Full rollout by July.
  63. SDK Index Provides usage data, insights and data safety informations

    easily.
  64. LiveOps Beta Display your limited offers, events, updates, announcements on

    Play Store to have more reach.
  65. Integrity API Protects your app from potential fraudulent actions

  66. Others Signing Key Rotation Support More flexibility in subscriptions Ultra

    low price points Target API requirements
  67. Q&A P.S We are hiring. Email me at contact@aungkyawpaing.dev