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. Alternatively you can obtain a default implementation by callingcreateSharedPreferencesStorage(Context)
.IMPORTANT: If you change the custom storage, make sure you can migrate 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)
Read a preference from the storagevoid
put(java.lang.String key, java.lang.String value)
Stores a preference 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)
Stores a preference in the storage. Passing innull
deletes the value.- Parameters:
key
- The key of the preferencevalue
- The value for the given key
-
get
@Nullable java.lang.String get(@NonNull java.lang.String key)
Read a preference 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 the key provided.
-
-