Each low level API has its own defaults/constants set in the SDMCommon library. Default values of preferences can be found in the SDMConstants class.
ISDMPreferences public void setIntPreference(String key, int value) public void setLongPreference(String key, long value) public void setFloatPreference(String key, float value) public void setBooleanPreference(String key, boolean value) public void setStringPreference(String key, String value) public void resetPreference(String key) public boolean containsPreference(String key) public Float getFloatPreference(String key) public Integer getIntPreference(String key) public Long getLongPreference(String key) public Boolean getBooleanPreference(String key) public String getStringPreference(String key) void registerPreferenceChangeListener(String key,ISDMPreferenceChangeListener changeListener) void unRegisterPreferenceChangeListener(String key,ISDMPreferenceChangeListener changeListener); public void removePreference(String key) throws SDMPreferencesException;
ISDMPreferenceChangeListener void onPreferenceChanged(String key,Object value)
Android offers an optimized storage for preferences called SharedPreferences (even with automatic Preference screen generation from XML). Modified and custom preferences will be automatically persisted into the default SharedPreferences of the application. Preferences must not contain any secure information. For this purpose, use SDMPersistence in secure mode or the Data Vault from SUP.
SDMComponents preferences can be reset to their default values using the resetPreference() method or by removing them from SharedPreferences.
Any changes to the SDMComponents preferences will be automatically validated regardless whether they are modified by using SDMPreferences or by using the default API of SharedPreferences. If you change the value of a preference to an invalid value while using the SharedPreferences API of the OS, the invalid value will automatically be removed at runtime and the preference will be set to its default value without any notification. Application developers are encouraged to use the API of ISDMPreferences so they will be notified about invalid values.
You can register a preference change listener for each preference in SDMPreferences (including custom preferences) so that you will be notified if the value of a given preference has changed.
Preference change listener notification and preference validation can only be done after the initialization of the appropriate component. It is not recommended to change the values of SDK related preferences outside runtime. For example, if you change the root folder of persisted data at runtime, the SDMPersistence component will automatically move all the persisted data. However, changing this value before the initialization of the SDMPersistence component can result in the loss of persisted data.
The OData SDK provides reusable custom Preference classes as an extension of standard Preference classes provided by the OS for handling Long, Float, and Integer preferences. These custom classes can be reused in preference XMLs or in the custom preferences screen of the application. Custom preference classes can be found in the SDMCommon Component package of the OData SDK.