Package com.unblu.sdk.core.configuration
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 viacreateSharedPreferencesStorage(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 Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static UnbluPreferencesStorage
createSharedPreferencesStorage(android.content.Context context)
Creates a default implementation ofUnbluPreferencesStorage
which stores the preferences inside theSharedPreferences
of the app with modeContext.MODE_PRIVATE
java.lang.String
get(java.lang.String key)
A preference should be read from the storagevoid
put(java.lang.String key, java.lang.String value)
A preference should be stored in the storage
-
-
-
Method Detail
-
createSharedPreferencesStorage
@NonNull static UnbluPreferencesStorage createSharedPreferencesStorage(@NonNull android.content.Context context)
Creates a default implementation ofUnbluPreferencesStorage
which stores the preferences inside theSharedPreferences
of the app with modeContext.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 preferencevalue
- 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.
-
-