Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What's new in android 2018 (dev fest)

126 views

Published on

What's new in android 2018, a content created by Google, and conducted by Shady Selim, for developers attending DevFest all across Egypt.
It combines all the latest Android for Developers updates

Published in: Software
  • Be the first to comment

What's new in android 2018 (dev fest)

  1. 1. Shady Selim Mobile Team Lead What’s new in Android
  2. 2. What’s New In Android PIA s
  3. 3. Android App Bundle
  4. 4. Source: Partner provided data 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 APK size (MBs) Conversion rate decreases as apps get larger Play Store conversion rate (% of visitors who install) Trendline
  5. 5. xxhdpi hdpixhdpi mdpi ldpixxxhdpi
  6. 6. xxhdpi arm hdpi arm xhdpi arm mdpi arm ldpi arm xxxhdpi arm xxhdpi x86 hdpi x86 xhdpi x86 mdpi x86 ldpi x86 xxxhdpi x86
  7. 7. xxhdpi arm64 hdpi arm64 xhdpi arm64 mdpi arm64 ldpi arm64 xxxhdpi arm64 xxhdpi arm hdpi arm xhdpi arm mdpi arm ldpi arm xxxhdpi arm xxhdpi x86 hdpi x86 xhdpi x86 mdpi x86 ldpi x86 xxxhdpi x86 xxhdpi x86_64 hdpi x86_64 xhdpi x86_64 mdpi x86_64 ldpi x86_64 xxxhdpi x86_64
  8. 8. xxhdpi arm64 v:14 hdpi arm64 v: 16 xhdpi arm64 v:15 mdpi arm64 v:17 ldpi arm64 v:18 xxxhdpi arm64 v:13 xxhdpi arm v:20 hdpi arm v:22 xhdpi arm v:21 mdpi arm v:23 ldpi arm v:24 xxxhdpi arm v:19 xxhdpi x86 v: 8 hdpi x86 v:10 xhdpi x86 v:9 mdpi x86 v: 11 ldpi x86 v:12 xxxhdpi x86 v: 7 xxhdpi x86_64 v: 2 hdpi x86_64 v: 4 xhdpi x86_64 v:3 mdpi x86_64 v:5 ldpi x86_64 v: 6 xxxhdpi x86_64 v: 1
  9. 9. xxhdpi arm64 v:14 hdpi arm64 v: 16 xhdpi arm64 v:15 mdpi arm64 v:17 ldpi arm64 v:18 xxxhdpi arm64 v:13 xxhdpi arm v:20 hdpi arm v:22 xhdpi arm v:21 mdpi arm v:23 ldpi arm v:24 xxxhdpi arm v:19 xxhdpi x86 v: 8 hdpi x86 v:10 xhdpi x86 v:9 mdpi x86 v: 11 ldpi x86 v:12 xxxhdpi x86 v: 7 xxhdpi x86_64 v: 2 hdpi x86_64 v: 4 xhdpi x86_64 v:3 mdpi x86_64 v:5 ldpi x86_64 v: 6 xxxhdpi x86_64 v: 1
  10. 10. Android App Bundle Benefit from a smaller app Stop managing multiple APKs Deliver features on-demandBETA
  11. 11. Android App Bundle Benefit from a smaller app Stop managing multiple APKs Deliver features on-demandBETA
  12. 12. Source: Partner provided data saving 11% saving 23% saving 45% saving 22%28% saving ABA English Airbnb LinkedIn Perigee saving 49% RV AppStudios saving 64% Memrise Pluto. TV
  13. 13. Optimized APK for each device Upload an Android App Bundle Dynamic Delivery
  14. 14. Optimized APK for each device Upload an Android App Bundle Dynamic Delivery
  15. 15. /res/xxxhdpi classes.dex /res/xxhdpi config_xxxhdpi.apkbase.apk config_xxxhdpi.apk /res/xhdpi /res/hdpi config_xhdpi.apk config_hdpi.apk /res/mhdpi /res/ldpi config_mhdpi.apk config_ldpi.apk /lib/x86 /lib/arm config_x86.apk config_arm.apk /res/values-en /res/values-fr config_en.apk config_fr.apk /res/values-es config_es.apk …
  16. 16. App Bundle APK
  17. 17. Android App Bundle Start today at g.co/androidappbundle
  18. 18. Android Jetpack Accelerate App Development
  19. 19. supported devices
  20. 20. Refactor android.support.v4.* android.support.v7.* // etc. androidx.*
  21. 21. Jetpack Architecture
  22. 22. Jetpack Architecture Lifecycle Lifecycle Aware Components
  23. 23. Jetpack Architecture Lifecycle Lifecycle Aware Components ViewModel View data decoupled from OS lifecycle
  24. 24. Jetpack Architecture Lifecycle Lifecycle Aware Components ViewModel View data decoupled from OS lifecycle Room SQLite object mapping
  25. 25. Jetpack Architecture Lifecycle Lifecycle Aware Components ViewModel View data decoupled from OS lifecycle Room SQLite object mapping LiveData Lifecycle aware observables
  26. 26. Jetpack Architecture Lifecycle Lifecycle Aware Components ViewModel View data decoupled from OS lifecycle Paging (1.0!) Asynchronous data retrieval Room SQLite object mapping LiveData Lifecycle aware observables
  27. 27. Jetpack Architecture WorkManager Job scheduling Navigation Backstack and app flows PREVIEW
  28. 28. View Models Simplifying Android development
  29. 29. 2016: What is the hardest part of Android Development?
  30. 30. ViewModel onCleared()
  31. 31. ViewModel onCleared()
  32. 32. ViewModel + LiveData onCleared() observe LiveData
  33. 33. ViewModel + LiveData onCleared() LiveData observe
  34. 34. ViewModel + LiveData onCleared() LiveData observe
  35. 35. ViewModel + LiveData onCleared() LiveData
  36. 36. ViewModel + LiveData onCleared() LiveData observe
  37. 37. ViewModel + LiveData onCleared() LiveData observe
  38. 38. ViewModel + LiveData onCleared() LiveData observe
  39. 39. ViewModel + LiveData onCleared() LiveData
  40. 40. Room A better way to do databases
  41. 41. 2016: How do you do Databases on Android?
  42. 42. Database SQLite App Logic Content Provider
  43. 43. Database Uri App Logic Content ProviderSQLite
  44. 44. Database Content Values Uri App Logic Content ProviderSQLite
  45. 45. App Logic Content Provider Database Content Values Uri SQLite Not type- safe
  46. 46. App Logic Content Provider Database Content Values Uri SQLite Not type- safe Not type- safe
  47. 47. App Logic Content Provider Database Content Values Uri SQLite Not type- safe Not type- safe
  48. 48. RoomDatabase App Logic Content Provider Content Values Uri Not type- safe Not type- safe SQLite
  49. 49. Room DAOSQLite
  50. 50. Room SQL DAO View ModelSQLite Type-safe
  51. 51. Room SQL Entities DAO View Model Type-safeType-safe SQLite
  52. 52. using or plan to use
  53. 53. using or plan to use
  54. 54. WorkManager Backwards compatible background work PREVIEW
  55. 55. Battery Optimizations Optimize background tasks to stay charged longer
  56. 56. Unlimited Background Services Doze App Standby Limited Broadcasts Release Wakelocks Service Limitations App Standby Buckets Background Restrictions
  57. 57. There is still a lot of work to do Sending logs Uploading images and videos Syncing data Processing data
  58. 58. Basic Work: upload a photo upload
  59. 59. // A simple Worker class UploadPhotoWorker : Worker() { override fun doWork(): WorkerResult { uploadPhoto() return WorkerResult.SUCCESS } } SUCCESS FAILURE RETRY Runs on a background thread
  60. 60. // Creating a work request and enqueuing it val request: WorkRequest = OneTimeWorkRequestBuilder<UploadPhotoWorker>().build() WorkManager.getInstance().enqueue(request) Ω
  61. 61. What if you lose connectivity? Use constraints!
  62. 62. // Creating a work request with network constraints val constraints = Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED) .build() val request = OneTimeWorkRequestBuilder<UploadPhotoWorker>() .setConstraints(constraints) .build() WorkManager.getInstance().enqueue(request)
  63. 63. Show Progress upload
  64. 64. Chain Work compress upload
  65. 65. Parallel Work upload
  66. 66. Complex Flows filter filter filter compress upload
  67. 67. When to use? Best-Effort Exact Timing ThreadPool Coroutines ThreadPool Coroutines
  68. 68. When to use? Best-Effort Guarantee d Execution Exact Timing Deferrable ThreadPool Coroutines ThreadPool Coroutines Foreground Service WorkManager
  69. 69. WorkManager Respects users battery Works with OS Backwards compatible (API14)
  70. 70. Navigation How to get around your app PREVIEW
  71. 71. Challenges for navigation Fragment Transactions Deep Links Passing Arguments Up and Back Errorprone Boilerplate Testing
  72. 72. Home Category Item https://... Need to be created and added to back stack on deep link
  73. 73. Navigation Graph A navigation graph is a blueprint of screens and the actions that link them.
  74. 74. Navigation Define navigation graph with visual tool / XML: Make a single navigate() call and runtime library handles everything
  75. 75. Safe Args Type-safe arguments when launching a Fragment
  76. 76. HelpFragment.kt if (!arguments.containsKey("screenName")) { throw IllegalArgumentException() } val category: Int = arguments.getInt("category") val screenName: String = arguments.getString("screenName")
  77. 77. HomeFragment.kt findViewById<Button>(R.id.help_button).setOnClickListener { v -> val helpDirections = HomeFragmentDirections.help("Home") helpDirections.category = 1703 v.findNavController().navigate(helpDirections) }
  78. 78. HelpFragment.kt val args : HelpFragmentArgs = HelpFragmentArgs.fromBundle(arguments) val screenName: String = args.screenName val category: Int = args.category
  79. 79. Navigation IDE tooling for app navigation Manage deeplinks Safe argument passing
  80. 80. Jetpack Architecture Start today at d.android.com/arch
  81. 81. Integration Tests e2e Tests Unit Tests Android Test Part of Jetpack
  82. 82. @RunWith(AndroidJUnit4::class) class SimpleUnifiedTest { @Test fun viewIsVisible() { assertEquals(view.visibility, View.VISIBLE) } } Failed: Expected 0 but was 16 F
  83. 83. @RunWith(AndroidJUnit4::class) class SimpleUnifiedTest { @Test fun viewIsVisible() { assertThat(view).isVisible() } } Failed: View was not visible F
  84. 84. Core Platform
  85. 85. Battery App Standby Buckets usage based access to jobs, alarms, network, messaging Background Restriction user can restrict badly-behaved apps
  86. 86. Background Inputs & Privacy
  87. 87. Kotlin Performance & Compiler ART, D8, R8 Nullability support library and libcore
  88. 88. Android KTX Part of Jetpack Concise, readable code. A suite of libraries Android KTX, Testing KTX, ...
  89. 89. Background Text Measurement Text measurement is expensive Up to 80 to 90% of the draw/measure/layout loop Pre-computed text API offloads most of the work to a worker thread PrecomputedText.create(...)
  90. 90. Baseline distance
  91. 91. val tv: TextView // Distance from top to first baseline tv.firstBaselineToTopHeight = distancePx // Distance from bottom to last baseline tv.lastBaselineToBottomHeight = distancePx
  92. 92. Smart Linkify Like linkify, but smarter...
  93. 93. Spannable text = ... TextLinks.Request request = new TextLinks.Request.Builder(text); // On background thread executor.execute { TextClassifier.generateLinks(request).apply(text); textview.post { textview.text = text } }
  94. 94. Accessibility View android:accessibilityPaneTitle setAccessibilityPaneTitle() TextView android:accessibilityHeading setAccessibilityHeading() Navigation Improvements
  95. 95. Security Unified BiometricDialog @deprecated FingerprintManager Stronger protection for private keys StrongBox backend Build.SERIAL doesn’t work anymore
  96. 96. System UI Integrating fully with Android
  97. 97. Display Cutouts Simulate notches in developer options (skip the electrical tape) WindowInsets#getDisplayCutout() android:windowLayoutInDisplayCutoutMode ● mode=”never” ● mode=”default” ● mode=”shortEdges” + DisplayCutout#getSafeInsets() ● mode=”shortEdges” + DisplayCutout#getBounds()
  98. 98. Slices A new approach to remote content ● Within an app or between apps ● Structured data, flexible templates ● Interactive, updatable ● Backwards-compatible! ● (Support Library, KitKat/API 19+)
  99. 99. Actions Deep links into your app ● “shortcuts with parameters” ● “a visible Intent” Define actions in actions.xml Register with App Indexing to show as on-device search results
  100. 100. Notifications People love messages …so we focused on MessagingStyle ● Inline images/stickers ● Participant images ● Smart reply UI ● RemoteInput.setChoices() And more!
  101. 101. What’s New In Android Android App Bundle https://g.co/androidappbundle Android Jetpack https://d.android.com/jetpack https://d.android.com/kotlin https://d.android.com/arch https://d.android.com/arch/navigation https://d.android.com/arch/workmanager Core Platform App Standby Buckets Background Restrictions System UI Display Cutouts Slices & Actions Notifications
  102. 102. Thank You!

×