Provides services to store and retrieve profile and app specific data. There are three types of storage available to profiles and apps:
Store currentAppConfig — An object that stores app data only.
Store currentAppData — An object that stores data associated with both the app and the profile.
Store currentProfileData — An object that stores profile data only. This data is private for a profile, but available to all apps and can be overwritten
by another app if the same access key is used.
|
Associated with the current profile |
Not associated with any profiles |
|
|---|---|---|
|
Associated with the current app |
This storage is associated with both a profile and an app. Data stored here is different from profile to profile, and from app to app. |
This storage is associated with an app. Data stored here does not change if the profile is switched, but is different from app to app. |
|
Not associated with any app |
This storage is associated with a profile. Data stored here does not change if the app is changed, but is different from profile to profile. This data is available to all apps and can be overwritten by another app if the same access key is used. |
Not Supported. |
Apps and profiles can store primitive JavaScript String values. To store JSONable JavaScript objects use JSON.stringify() to store and JSON.parse() to retrieve the values. The information stored persists after
exiting the app, launching a new app, or switching profiles. The storage is independent of the app's lifecycle.
Only uninstalling the app removes all app data. Deleting the profile removes all profile data.
Each data element in the Store object is a name-value pair. A name-value pair or key-value pair is a
fundamental data representation in computing systems and applications. Each Store object instantiation is a set of key-value
pairs providing an open-ended data structure that allows for future extension without modifying existing code or data. The
data model can be expressed as a collection of
string tuples “name, value”. Keys are unique only within each Store object.
You access the three types of storage objects in the following ways:
currentAppConfig.get()currentAppData.get()currentProfileData.get()currentAppConfig.set()currentAppData.set()currentProfileData.set()
Provides data storage services through the Store class for apps, profiles, and app/profile combinations.
Use the global namespaces defined by currentProfileData, currentAppData, and currentAppConfig.
currentAppConfig namespace to access app data that does not change with the profile
This storage is associated with an app. Data stored here does not change if the profile is switched, but is different from
app to app.
The same key may be found in currentProfileData, currentAppData, and currentAppConfig.
Example
Properties
|
Property |
Type |
Description |
|---|---|---|
|
|
|
The unique string identifier of the app associated with this data storage. |
|
|
|
Returns |
|
|
|
The type of the data store represented as a |
Methods
Boolean delete(String key)
Deletes the key-value pair specified by the given unique
key
. The parameter
key
is a unique String to
identify the storage to be deleted. Returns true if successful or if the
key
is not found.
String get(String key)
Returns the data storage value associated with the given unique
key
. The parameter
key
is a
unique String to retrieve the data store value. Returns null if the
key
does not exist in this data store.
Array getIDs()
Returns an array of strings containing all existing keys for this data store. If no keys exist, this method returns an empty array.
Boolean set(String key, String value)
Sets a
value
associated with a unique
key
. The parameter
key
is a unique
string to identify the storage associated with the given string
value
.
The parameter
value
is the string which is stored and associated with the given string
key
. If the
value
is a JSONable
JavaScript object, first call JSON.stringify() so that the JSON string is stored. Returns true if successful.
currentAppData namespace to access app and profile data
This storage is associated with both a profile and an app. Data stored here is different from profile to profile, and from
app to app. The
same key may be found in currentProfileData, currentAppData, and currentAppConfig.
Example
Properties
|
Property |
Type |
Description |
|---|---|---|
|
|
|
The unique string identifier of the app associated with this data storage. |
|
|
|
The unique string identifier of the profile associated with this data storage. |
|
|
|
The type of the data store represented as a |
Methods
Boolean delete(String key)
Deletes the key-value pair specified by the given unique
key
. The parameter
key
is a
unique String to identify the storage to be deleted. Returns true if successful or if the
key
is not found.
String get(String key)
Returns the data storage value associated with the given unique
key
. The parameter
key
is a
unique String to retrieve the data store value. Returns null if the
key
does not exist in this data store.
Array getIDs()
Returns an array of strings containing all existing keys for this data store. If no keys exist, this method returns an empty array.
Boolean set(String key, String value)
Sets a
value
associated with a unique
key
. The
parameter
key
is a unique string to identify the storage associated with the given string
value
.
The parameter
value
is the string which is stored and associated with the given string
key
. If the
value
is a
JSONable JavaScript object, first call JSON.stringify() so that the JSON string is stored. Returns true if successful.
currentProfileData namespace to access profile data that does not change with the app
This storage is associated with a profile. Data stored here does not change if the app is changed, but is different
from profile to profile. This data is available to all apps and can be overwritten by another app if the same access key is
used. The same key may be found in currentProfileData, currentAppData, and currentAppConfig.
Example
Properties
|
Property |
Type |
Description |
|---|---|---|
|
|
|
Returns |
|
|
|
The unique string identifier of the profile associated with this data storage. |
|
|
|
The type of the data store represented as a |
Methods
Boolean delete(String key)
Deletes the key-value pair specified by the given unique
key
. The parameter
key
is a
unique String to identify the storage to be deleted. Returns true if successful or if the
key
is not found.
String get(String key)
Returns the data storage value associated with the given unique
key
. The parameter
key
is a unique String to
retrieve the data store value. Returns null if the
key
does not exist in this data store.
Array getIDs()
Returns an array of strings containing all existing keys for this data store. If no keys exist, this method returns an empty array.
Boolean set(String key, String value)
Sets a
value
associated with a unique
key
. The parameter
key
is a unique
string to identify the storage associated with the given string
value
. The parameter
value
is the string
which is stored and associated with the given string
key
. If the
value
is a
JSONable JavaScript object, first call JSON.stringify() so that the JSON string is stored. Returns true if successful.