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

        @NonNull
        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
        Parameters:
        context - The context of the application
        Returns:
        The default implementation using SharedPreferences
      • put

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

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