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 calling
This is useful if encryption should used. Alternatively you can obtain a default implementation by calling
createSharedPreferencesStorage(Context).
IMPORTANT: If you change the custom storage, make sure you can migrate the old data to the new storage.
-
Method Summary
Modifier and TypeMethodDescriptionstatic UnbluPreferencesStoragecreateSharedPreferencesStorage(android.content.Context context) Creates a default implementation ofUnbluPreferencesStoragewhich stores the preferences inside theSharedPreferencesof the app with modeContext.MODE_PRIVATEstatic UnbluPreferencesStoragecreateSharedPreferencesStorage(android.content.Context context, String name) Creates a default implementation ofUnbluPreferencesStoragewhich stores the preferences inside theSharedPreferencesof the app with modeContext.MODE_PRIVATERead a preference from the storagevoidStores a preference in the storage.
-
Method Details
-
put
Stores a preference in the storage. Passing innulldeletes the value.- Parameters:
key- The key of the preferencevalue- The value for the given key
-
get
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.