-
@RestrictTo(value = RestrictTo.Scope.LIBRARY) public final class StorageHelper
-
-
Method Summary
Modifier and Type Method Description static SharedPreferencesgetPreferences(@NonNull() Context context, String namespace)static SharedPreferencesgetPreferences(@NonNull() Context context)static StringgetString(@NonNull() Context context, @NonNull() String key, String defaultValue)static StringgetStringFromPrefs(@NonNull() Context context, @NonNull() CleverTapInstanceConfig config, String rawKey, String defaultValue)returns a String From Local Storage.The key used for getting the value depends upon a few factors:A) When config is default instance:1. static voidpersist(SharedPreferences.Editor editor)static voidpersistImmediately(SharedPreferences.Editor editor)Use this method, when you are sure that you are on background thread static voidputString(Context context, String key, String value)static voidputString(Context context, CleverTapInstanceConfig config, String key, String value)static voidputStringImmediate(Context context, String key, String value)static voidremove(Context context, String key)static voidremoveImmediate(Context context, String key)static StringstorageKeyWithSuffix(@NonNull() CleverTapInstanceConfig config, @NonNull() String key)static StringstorageKeyWithSuffix(String accountID, @NonNull() String key)static booleangetBoolean(Context context, String key, boolean defaultValue)static intgetInt(Context context, String key, int defaultValue)static intgetIntFromPrefs(Context context, CleverTapInstanceConfig config, String rawKey, int defaultValue)static longgetLongFromPrefs(Context context, CleverTapInstanceConfig config, String rawKey, int defaultValue, String nameSpace)static voidputBoolean(Context context, String key, boolean value)static voidputBooleanImmediate(Context context, String key, boolean value)static voidputInt(Context context, String key, int value)static voidputIntImmediate(Context context, String key, int value)-
-
Method Detail
-
getPreferences
static SharedPreferences getPreferences(@NonNull() Context context, String namespace)
-
getPreferences
static SharedPreferences getPreferences(@NonNull() Context context)
-
getString
static String getString(@NonNull() Context context, @NonNull() String key, String defaultValue)
-
getStringFromPrefs
static String getStringFromPrefs(@NonNull() Context context, @NonNull() CleverTapInstanceConfig config, String rawKey, String defaultValue)
returns a String From Local Storage.The key used for getting the value depends upon a few factors:A) When config is default instance:1. we search for the value for key "[rawKey]:[account_id]" and return it2. if no value is found for key "[rawKey]:[account_id]", we search for just key "[rawKey]" and return it3. if no value is found for key "[rawKey]", we return default valueB) When config is NOT default instance:1. we search for the value for key "[rawKey]:[account_id]" and return it2. if no value is found for key "[rawKey]:[account_id]", we return default value
-
persist
static void persist(SharedPreferences.Editor editor)
-
persistImmediately
@WorkerThread() static void persistImmediately(SharedPreferences.Editor editor)
Use this method, when you are sure that you are on background thread
-
putString
static void putString(Context context, CleverTapInstanceConfig config, String key, String value)
-
putStringImmediate
static void putStringImmediate(Context context, String key, String value)
-
removeImmediate
static void removeImmediate(Context context, String key)
-
storageKeyWithSuffix
@Deprecated() static String storageKeyWithSuffix(@NonNull() CleverTapInstanceConfig config, @NonNull() String key)
-
storageKeyWithSuffix
static String storageKeyWithSuffix(String accountID, @NonNull() String key)
-
getBoolean
static boolean getBoolean(Context context, String key, boolean defaultValue)
-
getIntFromPrefs
static int getIntFromPrefs(Context context, CleverTapInstanceConfig config, String rawKey, int defaultValue)
-
getLongFromPrefs
static long getLongFromPrefs(Context context, CleverTapInstanceConfig config, String rawKey, int defaultValue, String nameSpace)
-
putBoolean
static void putBoolean(Context context, String key, boolean value)
-
putBooleanImmediate
static void putBooleanImmediate(Context context, String key, boolean value)
-
putIntImmediate
static void putIntImmediate(Context context, String key, int value)
-
-
-
-