Preferences DataStore - Forget about SharedPreferences | Android Studio Tutorial

Поділитися
Вставка
  • Опубліковано 16 гру 2024

КОМЕНТАРІ • 50

  • @jam4l
    @jam4l 2 роки тому +6

    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)

  • @JamieKeefer
    @JamieKeefer 4 роки тому

    Thank you for the quick tutorial. That was an eye opener.

  • @bjugdbjk
    @bjugdbjk 3 роки тому +1

    Thanks a lot for coding in architecture style and showing the right way of implementing the pref datasore, tysm for sharing the knowledge.

  • @nataliavalero3340
    @nataliavalero3340 Рік тому

    Awesome tutorial using clean code, exactly what I needed, thanks a lot :)

  • @vishwaraghavendra8332
    @vishwaraghavendra8332 4 роки тому +11

    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 роки тому +7

      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.

  • @jayantkumar1954
    @jayantkumar1954 4 роки тому +1

    Awesome tutorial...everything has cleared.. Thank you very much ❤️😀

  • @jam4l
    @jam4l 2 роки тому

    Another great tutorial, simple and concise, Thank you.

  • @شاشةالمسلمالصغير
    @شاشةالمسلمالصغير 3 роки тому +1

    Thank you. If we have more than one data to store, should we create a save fun and a read fun for each data?

  • @jitenrathore9136
    @jitenrathore9136 4 роки тому

    Awesome vedio sir keep calm and upload more vedios you are genius man

  • @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)?

  • @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

  • @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!

  • @thuongpham6605
    @thuongpham6605 2 роки тому

    how to restart textfield still get value data saved???

  • @kirakorunov5407
    @kirakorunov5407 2 роки тому

    Thanks bro!!!

  • @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 ❤

  • @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

  • @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?

  • @fahidsarker4858
    @fahidsarker4858 3 роки тому

    Can we use it with preference screen layouts?

  • @hdkloh
    @hdkloh 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.

  • @m.gentaarya1123
    @m.gentaarya1123 2 роки тому

    How to implements to fragment ?

  • @entrealist
    @entrealist 4 роки тому

    Okay, Okay, I will work

  • @ravisahu3301
    @ravisahu3301 Рік тому

    can you please make a video on encrypted pref datastore

  • @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??

  • @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.

  • @fikascrew
    @fikascrew 4 роки тому

    Please explain about coroutine flow spesifictly sir.

  • @mauriciopriego1700
    @mauriciopriego1700 3 роки тому

    thank you

  • @rizkiadisaputra5971
    @rizkiadisaputra5971 4 роки тому

    is store credential in shared prefer are secure?

    • @StevdzaSan
      @StevdzaSan  4 роки тому +1

      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

  • @byronlovelace8379
    @byronlovelace8379 4 роки тому +1

    Nobody knows how to over engineer a solution better than Google..

  • @ahmedhegazy8452
    @ahmedhegazy8452 4 роки тому

    Thanks

  • @Rafael-hk9pg
    @Rafael-hk9pg 3 роки тому

    Why LiveData and why Flow?

  • @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.

  • @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 роки тому +1

      I would say 'cleaner code', plus SharedPreferences is running on main thread while DataStore uses Kotlin coroutines.

  • @ilhamaliyudin4779
    @ilhamaliyudin4779 4 роки тому

    More complex then shared pref -_-

  • @gauravmaurya8602
    @gauravmaurya8602 4 роки тому +1

    Please make java tutorial videos

  • @MohamedGamal-ur3xk
    @MohamedGamal-ur3xk 2 роки тому

    thank you