public final class UserPreferences extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
UserPreferences.Unit
Units for expressing distances.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
clear()
Clear all user info.
|
static boolean |
getBooleanSetting(String settingName,
boolean defaultValue)
Generic get boolean setting.
|
static String |
getInstallationIdHash()
Get the installation ID hash.
|
static long |
getLongSetting(String settingName)
Generic get long setting.
|
static long |
getLongSetting(String settingName,
long defaultValue)
Generic get long setting.
|
static Locale |
getPreferredLocale()
Get the preferred
Locale. |
static UserPreferences.Unit |
getSettingUnits()
Get the preferred distance units defined by
UserPreferences.Unit. |
static String |
getStringSetting(String settingName)
Generic get string setting.
|
static String |
getStringSetting(String settingName,
String defaultValue)
Generic get string setting.
|
static boolean |
hasSetting(String settingName)
Checks whether the provided setting is stored within the settings.
|
static boolean |
loaded()
Check if the preferences are loaded into memory.
|
static void |
setBooleanSetting(String settingName,
boolean settingValue)
Generic set boolean setting.
|
static void |
setLongSetting(String settingName,
long settingValue)
Generic set long setting.
|
static void |
setPreferredLocale(Locale locale)
Set the preferred
Locale. |
static void |
setSettingUnits(UserPreferences.Unit unit)
Set the preferred distance units.
|
static void |
setStringSetting(String settingName,
String settingValue)
Generic set string setting.
|
public static boolean loaded()
true if loaded, false otherwise.public static String getInstallationIdHash()
null if not persisted.public static UserPreferences.Unit getSettingUnits()
UserPreferences.Unit.
Unless the settings are explicitly set using UserPreferences.setSettingUnits(Unit), this method will
return the units appropriate for the current device locale.public static void setSettingUnits(UserPreferences.Unit unit)
unit - The preferred distance units. null will remove this preference and default
to appropriate units based on locale.public static Locale getPreferredLocale()
Locale. The preferred Locale is determined in the following
priority:
UserPreferences.setPreferredLocale(Locale)Locale.getDefault()Locale has been specified, the returned value is always the device default.Locale.public static void setPreferredLocale(Locale locale)
public static void clear()
public static String getStringSetting(String settingName)
settingName - The name of the setting.public static String getStringSetting(String settingName, String defaultValue)
settingName - The name of the setting.defaultValue - The value returned when the setting is not found.public static void setStringSetting(String settingName, String settingValue)
settingName - A non null name of the settingsettingValue - The setting valuepublic static long getLongSetting(String settingName)
settingName - The name of the setting.public static long getLongSetting(String settingName, long defaultValue)
settingName - The name of the setting.defaultValue - The value returned when the setting is not found.public static void setLongSetting(String settingName, long settingValue)
settingName - The name of the settingsettingValue - The long value of the settingpublic static boolean getBooleanSetting(String settingName, boolean defaultValue)
settingName - The name of the setting.defaultValue - The value returned when the setting is not found.public static void setBooleanSetting(String settingName, boolean settingValue)
settingName - The name of the settingsettingValue - The boolean value of the settingpublic static boolean hasSetting(String settingName)
settingName - The name of the setting.true if the value exists, false otherwise.Copyright © 2013-2016 INRIX, Inc. All Rights Reserved.