Preferences DataStore - Forget about SharedPreferences | Android Studio Tutorial

  Рет қаралды 17,299

Stevdza-San

Stevdza-San

Күн бұрын

Пікірлер: 52
@jam4l
@jam4l 2 жыл бұрын
Just FYI, you may need to pin a comment declaring that: The Context.createDataStore extension function has been removed and replaced with globalDataStore property delegate. Call globalDataStore once at the top level in your kotlin file. (official documentations)
@bjugdbjk
@bjugdbjk 3 жыл бұрын
Thanks a lot for coding in architecture style and showing the right way of implementing the pref datasore, tysm for sharing the knowledge.
@StevdzaSan
@StevdzaSan 3 жыл бұрын
Glad to help!
@vishwaraghavendra8332
@vishwaraghavendra8332 4 жыл бұрын
Great Tutorial! But i feel it's too much of code, unless your app is heavily dependent on SharedPreferences value.. The old way was simple and more compact
@StevdzaSan
@StevdzaSan 4 жыл бұрын
Nah its not hard, it's even simpler with separation, you just create repository class and from there manage all your datastore. You can even make a live template out of it.
@شاشةالمسلمالصغير
@شاشةالمسلمالصغير 3 жыл бұрын
Thank you. If we have more than one data to store, should we create a save fun and a read fun for each data?
@nataliavalero3340
@nataliavalero3340 Жыл бұрын
Awesome tutorial using clean code, exactly what I needed, thanks a lot :)
@patricioconti4852
@patricioconti4852 2 жыл бұрын
Stevdza-San great Tutorial! But now I would like to know how to use DataStore with PreferenceFragmet that formely used SharedPreferences. Is it possible? Thank you
@jayantkumar1954
@jayantkumar1954 4 жыл бұрын
Awesome tutorial...everything has cleared.. Thank you very much ❤️😀
@jam4l
@jam4l 2 жыл бұрын
Another great tutorial, simple and concise, Thank you.
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Anytime 👌
@JamieKeefer
@JamieKeefer 4 жыл бұрын
Thank you for the quick tutorial. That was an eye opener.
@hdkloh6857
@hdkloh6857 4 жыл бұрын
What is drawback of existing shared preferences over this...? Also there is another androidx library for security can you make video on that also & compare what to use & when... Nice video as always...👍
@StevdzaSan
@StevdzaSan 4 жыл бұрын
Old SharedPreferences is running on UI thread sadly. I will cover security library, but not right now.
@xpopcornx1747
@xpopcornx1747 4 жыл бұрын
​@@StevdzaSan It doesn't take many milliseconds to store data in shared preferences tho, it's just saving primitive values.
@nicolasgonzalez2986
@nicolasgonzalez2986 4 жыл бұрын
So for the data store is necessary to use Flow to set the connection through the live data and after the live data to the view? or we can avoid the flow implementation? just asking!
@lucianrekkless418
@lucianrekkless418 3 жыл бұрын
Thanks a lot man! As always very clear and constructed tutorial. Can you also create a video about using dataStore in Java for login session (storing user acount details)?
@jitenrathore9136
@jitenrathore9136 4 жыл бұрын
Awesome vedio sir keep calm and upload more vedios you are genius man
@bhavyavarmora4049
@bhavyavarmora4049 4 жыл бұрын
hii Nice tutorial I have doubt that I am getting cityName through response and i have to save that cityName so i don't want to make the call again and again for current cityName So How to store that cityName and for that what code we have to write in fragment i have written code till viewModel for dataStore. For this what code should be written in fragment??
@kirakorunov5407
@kirakorunov5407 2 жыл бұрын
Thanks bro!!!
@fahidsarker4858
@fahidsarker4858 3 жыл бұрын
Can we use it with preference screen layouts?
@vris1967
@vris1967 4 жыл бұрын
Hey Stefan! We are working on Android Application but we can't use Firebase Realtime Database fine. Can you make videos for us?
@ravisahu3301
@ravisahu3301 Жыл бұрын
can you please make a video on encrypted pref datastore
@thuongpham6605
@thuongpham6605 Жыл бұрын
how to restart textfield still get value data saved???
@m.gentaarya1123
@m.gentaarya1123 2 жыл бұрын
How to implements to fragment ?
@IvvyUPlay
@IvvyUPlay 4 жыл бұрын
I'm implementing it into a fragment class and if i donot restart the app the data doesnot store, how can I fix this?
@alij3fer
@alij3fer 4 жыл бұрын
Nice job sir ❤
@Rafael-hk9pg
@Rafael-hk9pg 3 жыл бұрын
Why LiveData and why Flow?
@entrealist
@entrealist 3 жыл бұрын
Okay, Okay, I will work
@kornraweephirawetsakun6356
@kornraweephirawetsakun6356 4 жыл бұрын
If my login register by create with mysql php and it check to db and i want to add admin and fix user pssword can i get it
@karan24189
@karan24189 3 жыл бұрын
My app is persisting the data even after uninstalling and reinstalling the app
@karan24189
@karan24189 3 жыл бұрын
silly mistake from my end allowBackup was true in android manifest. leaving the comment here might help someone
@mauriciopriego1700
@mauriciopriego1700 3 жыл бұрын
thank you
@MtaufiqH731
@MtaufiqH731 4 жыл бұрын
Please explain about coroutine flow spesifictly sir.
@ahmedhegazy8452
@ahmedhegazy8452 3 жыл бұрын
Thanks
@krishnamandava9919
@krishnamandava9919 4 жыл бұрын
what is the need and use of lificycle dependencies in this project?
@adeelwajid9779
@adeelwajid9779 4 жыл бұрын
because we are working with observers and Coroutines
@JamieKeefer
@JamieKeefer 4 жыл бұрын
ViewModel and LiveData are lifecycle aware means to store and use data.
@rizkiadisaputra5971
@rizkiadisaputra5971 4 жыл бұрын
is store credential in shared prefer are secure?
@StevdzaSan
@StevdzaSan 4 жыл бұрын
Android 9 (API level 28) started to restrict which apps could make the files in their data directories on internal storage world-accessible to other apps. Apps that target Android 9 or higher cannot make the files in their data directories world-accessible. Android 11 expands upon this restriction. If your app targets Android 11, it cannot access the files in any other app's data directory, even if the other app targets Android 8.1 (API level 27) or lower and has made the files in its data directory world-readable. Read more: developer.android.com/about/versions/11/privacy/storage
@kasems.m4896
@kasems.m4896 4 жыл бұрын
Also please show what to use instead of Asynchronous Task 😶
@adeelwajid9779
@adeelwajid9779 4 жыл бұрын
@Etelred Etelred it was not Asynchronous task, it was synchronous, if you want to use Asynchronous then you just need to use viewModelScope.launch(Dispatchers.IO) { async{ //write here your code } }
@bloodops3893
@bloodops3893 4 жыл бұрын
Yes, but you have more code than if you were using SharedPreferences. So it is, what is is :)
@StevdzaSan
@StevdzaSan 4 жыл бұрын
I would say 'cleaner code', plus SharedPreferences is running on main thread while DataStore uses Kotlin coroutines.
@byronlovelace8379
@byronlovelace8379 4 жыл бұрын
Nobody knows how to over engineer a solution better than Google..
@jeremylbt1980
@jeremylbt1980 4 жыл бұрын
In terms of coding simplicity shared preferences is more straight forward. On first look, this data store looks complex and non trivial.
@ilhamaliyudin4779
@ilhamaliyudin4779 4 жыл бұрын
More complex then shared pref -_-
@gauravmaurya8602
@gauravmaurya8602 4 жыл бұрын
Please make java tutorial videos
@MohamedGamal-ur3xk
@MohamedGamal-ur3xk 2 жыл бұрын
thank you
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 128 МЛН
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 10 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 32 МЛН
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 2,6 МЛН
How to use Kotlin Datastore on Android
15:47
DBTechProjects
Рет қаралды 2,6 М.
LiveData Explained - Android Architecture Component | Tutorial
12:12
Proto DataStore Android: Mastering User Session Handling in Your App!
13:17
Simplified Coding
Рет қаралды 1,3 М.
DataStore в Jetpack Compose | Android Studio
30:19
Neco Ru
Рет қаралды 7 М.
How to use DataStore Preferences  in Kotlin
24:34
Android Geek
Рет қаралды 10 М.
The Vim Experience
45:19
Bog
Рет қаралды 141 М.
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 128 МЛН