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)
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
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.
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)?
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
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!
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...👍
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??
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
@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 } }
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)
Thank you for the quick tutorial. That was an eye opener.
Thanks a lot for coding in architecture style and showing the right way of implementing the pref datasore, tysm for sharing the knowledge.
Glad to help!
Awesome tutorial using clean code, exactly what I needed, thanks a lot :)
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
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.
Awesome tutorial...everything has cleared.. Thank you very much ❤️😀
Another great tutorial, simple and concise, Thank you.
Anytime 👌
Thank you. If we have more than one data to store, should we create a save fun and a read fun for each data?
Awesome vedio sir keep calm and upload more vedios you are genius man
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)?
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
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!
how to restart textfield still get value data saved???
Thanks bro!!!
I'm implementing it into a fragment class and if i donot restart the app the data doesnot store, how can I fix this?
Nice job sir ❤
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
Hey Stefan!
We are working on Android Application but we can't use Firebase Realtime Database fine. Can you make videos for us?
Can we use it with preference screen layouts?
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...👍
Old SharedPreferences is running on UI thread sadly. I will cover security library, but not right now.
@@StevdzaSan It doesn't take many milliseconds to store data in shared preferences tho, it's just saving primitive values.
How to implements to fragment ?
Okay, Okay, I will work
can you please make a video on encrypted pref datastore
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??
what is the need and use of lificycle dependencies in this project?
because we are working with observers and Coroutines
ViewModel and LiveData are lifecycle aware means to store and use data.
Please explain about coroutine flow spesifictly sir.
thank you
is store credential in shared prefer are secure?
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
Nobody knows how to over engineer a solution better than Google..
Thanks
Why LiveData and why Flow?
In terms of coding simplicity shared preferences is more straight forward. On first look, this data store looks complex and non trivial.
Also please show what to use instead of Asynchronous Task 😶
@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
}
}
Yes, but you have more code than if you were using SharedPreferences. So it is, what is is :)
I would say 'cleaner code', plus SharedPreferences is running on main thread while DataStore uses Kotlin coroutines.
More complex then shared pref -_-
Please make java tutorial videos
thank you