ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Follow publication

Exploring Jetpack DataStore in Android

Vivek Singh
ProAndroidDev
Published in
4 min readSep 9, 2020

--

Image Source: Android Jetpack official page

SharedPreferences vs. DataStore

Image Source: Android Developers Blog

Types of DataStore

Setup Your Project

dependencies {
// Preferences DataStore
implementation "androidx.datastore:datastore-preferences:1.0.0-beta01"
}

Saving Data in DataStore

MusicPreferences.kt
MusicViewModel.kt

Conclusion

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Published in ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Responses (10)

Write a response