7. • Active development
• API may be added,
changed, removed
• Tested and highly-
functional
• Feature Stabilization
• No API changes
• APIs changed only in
response to critical
issues or community
feedback
Alpha Beta
8. Metadata that helps tools and other developers
understand your code
Experimental Annotations
Metadata
11. 02 New in Stable
01 Overview
03 Up to Beta
04 Debut in Alpha
05 Additional Talks
12. Unified API surface for accessing camera functionality
across the various OS versions and devices
CameraX
Hardware
13. • Adjusting exposure compensation
• Access to the information about
camera state and features
• Interoperability via Camera2Interop
CameraX
The latest improvements to the
common requests
androidx.camera:camera
14. CameraX
• HDR (High Dynamic Range) preview*
• Zoom ratio controls
• Do-Not-Disturb
Supports for the latest device and
OS features
* Supported for Pixel 4A and 5 only, but soon on more devices
androidx.camera:camera
15. CameraX
• Faster image capture
• Faster initialization*
Performace enhancement for
better experience
* Up to 25% on legacy devices, according to Google
androidx.camera:camera
16. // Set up the CameraController
val cameraController = LifecycleCameraController(context)
cameraController.bindToLifecycle(lifecycleOwner)
// Attach the CameraController to PreviewView
val previewView = findViewById(R.id.previewView)
previewView.setController(cameraController)
// Use the CameraController
cameraController.takePicture(...)
18. • ViewModel support into the core Hilt
• SavedStateHandle added as a default
• Integrated with Navigation and
Compose
Hilt
Reached Stable stage with changes
androidx.hilt:hilt
20. @HiltViewModel
class MyViewModel @Inject constructor(
val handle: SavedStateHandle,
val repository: Repository
) : ViewModel {
// ...
}
@AndroidEntryPoint
class MyFragment : Fragment() {
val viewModel: MyViewModel by viewModels()
val navigationGraphScoped: MyViewModel by
hiltNavGraphViewModels(R.id.nav_graph)
}
24. The recommended data persistence layer, providing increased usability and safety
over the platform
Architecture
Room
25. Experimental support for Kotlin Symbol Processing
Built-in support for enums and RxJava3
Introduction to QueryCallback
New annotation @ProviderTypeConverter
Room
2.3.0 Stable version
androidx.room:room
Support for Auto-Migrations
2.4.0 Alpha version
26. @ProvidedTypeConverter
class TimeStampConverter(timeformat: String) {
@TypeConverter
fun fromTimestamp(value: Long) {
// implementation
}
}
Room.inMemoryDatabaseBuilder(context, CacheDatabase::class)
.addTypeConverter(TimeStampConverter(getPreferredTimeStamp()))
.build()
28. @Database(
- version = 1,
+ version = 2,
entities = { Penang.class },
+ autoMigrations = {
+ @AutoMigration (from = 1, to = 2)
+ }
)
public abstract class DoggosDatabase extends RoomDatabase { }
29. Load and display small chunks of data to improve
network and system resource consumption
UI
Paging Library
30. Complete rewrite in Kotlin, supported for Kotlin coroutines and Flow
Asynchronous loading with RxJava and Guava primitives
Improvements to the repository and presentation layers
Supports for headers, footers, separators, and loading state
Paging Library
androidx.paging:paging
33. Safely and easily encrypt files
and SharedPreferences
Data
Security Crypto
34. val prefs: SharedPreferences = EncryptedSharedPreferences.create(
context,
"preference_file_name",
mainKey,
prefKeyEncryptionScheme = AES256_SIV,
prefValueEncryptionScheme = AES256_GCM,
)
// Use the resulting SharedPreferences object as usual.
prefs.edit()
.putBoolean("launch_completed", true)
.apply()
35. Can it be combined with
Room or DataStore?
Encrypted DataStore will be provided, Room can already be used with SQLCipher, not decided
yet if it’ll be included out of the box.
Answer
40. • Reached 2.0.0 stable
• MotionLayout to provide rich
animation and state management
ConstraintLayout
ConstraintLayout 2.0.0 stable
androidx:constraintlayout:constraintlayout
43. Clean up the internal implementation
Reduce undocumented behaviour and Increase stability
Fragment
Androidx:fragment:fragment
• Don’t forget to read the release note before updating to fragment:1.3.0
ActivityResult Integration
44. // Obtain the fragment manager. May be a childFragmentManager,
// if in a fragment, to observe child attachment.
val fm = supportFragmentManager
val listener = FragmentOnAttachListener{
fragmentManager, fragment ->
// Respond to the fragment being attached.
}
fm.addFragmentOnAttachListener(listener)
onAttachFragment() has been deprecated.
onAttachFragment()
45. 02 New in Stable
01 Overview
03 Up to Beta
04 Debut in Alpha
05 Additional Talks
46. Data storage solution that allows you to store key-value pairs
or typed object with protocol buffers
Data
DataStore
47. Fully asynchronous with Kotlin
coroutine / Flow support, RxJava
2&3
DataStore
Key-values pairs
Protocol buffers (strongly typed)
Your own plugin (Kotlin serialization)
Replacement for SharedPreference Multiple backing implementations
androidx.datastore:datastore
48. SharedPreferences DataStore
Asynchronous API
Synchronous API
Safe to call on UI thread
Call signal errors
Safe from runtime exceptions
Transactional API with strong
consistency guarantees
Handles data migration
Type safety
O only for change listener O via coroutine, RxJava
O O via runBlocking
X O
X O
X O
X O
X O
X O
49. // At the top level of your kotlin file:
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")
Create a preferences Datastore
50. val EXAMPLE_COUNTER = intPreferencesKey("example_counter")
val exampleCounterFlow: Flow<Int> = context.dataStore.data
.map { preferences ->
// No type safety.
preferences[EXAMPLE_COUNTER] ?: 0
}
Read from a Preferences Datastore
51. suspend fun incrementCounter() {
context.dataStore.edit { settings ->
val currentCounterValue = settings[EXAMPLE_COUNTER] ?: 0
settings[EXAMPLE_COUNTER] = currentCounterValue + 1
}
}
Write to a Preferences DataStore
52. val Context.prefStore: DataStore<Prefrences> by preferencesDataStore(
name = USER_PREFERENCES_NAME,
produceMigrations = { context ->
// Since we're migrating from SharedPreferences, add
// a migration based on the SharedPrefernces name
listOf(SharedPreferencesMigration(context, USER_PREFERENCES_NAME))
}
Migrate to DataStore
53. 02 New in Stable
01 Overview
03 Up to Beta
04 Debut in Alpha
05 Additional Talks
55. Prefix Indexing
Relevance ranking
Usage scoring
AppSearch
Fuzzy matching
Query expansion
Language support
Full featured vs. SQL Advanced full-text search
androix:appsearch:appsearch
56. Includes schemas for common object types
Centralised storage on Android S and later for
integrating into device-wide search
androix:appsearch:appsearch
AppSearch
57. Framework for navigating between destinations
within an app, now with multiple backstack
UI
Navigation
58. • Added in Navigation 2.4.0
• Utilising APIs which has been added to Fragment 1.4.0 internally.
Navigation
Multiple backstack
androidx.navigation:navigation
saveBackStack() restoreBackStack()
and
74. Form factors
What’s new in Foldables, Tablets, and Large Screens
Now is the Time: What’s New With Wear OS by Googlee
• androidx.window
• androidx.slidingpanelayout
• androidx.wear