Settings provides a central store for settings that can be updated from the cloud.

Typical Usage

A typical usage of settings is as follows:

First, your application needs to have the READ_SETTINGS permission in the AndroidManifest.xml.

<uses-permission android:name="com.amazon.dcp.settings.permission.READ_SETTINGS"/>
During application startup, provide a context to the {@link com.amazon.dcp.settings.SettingsCache SettingsCache} and optionally block waiting for the sync to complete:

{@sample ../samplecode/src/com/amazon/dcp/sample/SettingsSnippets.java Setup_SettingsCache}

At the top of one's class, create a static member using one of the Settings object model classes. This is analogous to defining a constant value used by your class, only with a Settings object your constant can be changed by the server.

{@sample ../samplecode/src/com/amazon/dcp/sample/SettingsSnippets.java Declare_Setting}

Later, use the object like so:

{@sample ../samplecode/src/com/amazon/dcp/sample/SettingsSnippets.java Use_Setting}

All types in this namespace are safe to use on any thread, including the UI thread, with the caveat that when the {@link com.amazon.dcp.settings.SettingsCache SettingsCache} is first initialized it must sync with the central settings database, which can lead to blocking if code tries to read settings from it before the sync is complete. See the {@link com.amazon.dcp.settings.SettingsCache SettingsCache} documentation for more details and options for working around.