Interface UnbluPreferencesStorage

  • public interface UnbluPreferencesStorage
    Interface which can be implemented to store the preferences of Unblu at a custom location.
    This is useful if encryption should used. Otherwise a default implementation can be used via createSharedPreferencesStorage(Context).

    IMPORTANT: if you change the custom storage, please be aware that you are somehow capable of migrating the old data to the new storage.

    • Method Detail

      • createSharedPreferencesStorage

        static UnbluPreferencesStorage createSharedPreferencesStorage​(@NonNull
                                                                      android.content.Context context)
        Creates a default implementation of UnbluPreferencesStorage which stores the preferences inside the SharedPreferences of the app with mode Context.MODE_PRIVATE
        context - The context of the application
        The default implementation using SharedPreferences
      • put

        void put​(@NonNull
                 java.lang.String key,
                 java.lang.String value)
        A preference should be stored in the storage
        key - The key of the preference
        value - The value for the given key
      • get

        java.lang.String get​(@NonNull
                             java.lang.String key)
        A preference should be read from the storage
        key - The key of the preference
        The value for the given key. Can be null if there is no value stored for this key.