App Preferences
Overview
The App Preferences API enables apps to store custom user-specific data and retrieve it when necessary. This allows you to enhance the UX of your apps by instrumenting them to preserve specific user settings and apply them when the app is relaunched.
The App Preferences API provides methods for updating, replacing and clearing user settings stored for the current or a specific app, as well as for all apps of the current user.
Storage
App preferences can be stored locally in a file, or remotely - using a REST service or io.Manager. By default, app preferences are stored locally in the %LocalAppData%/interop.io/io.Connect Desktop/UserData/<ENV>-<REG>/prefs
folder, where <ENV>-<REG>
represents the environment and region of io.Connect Desktop (e.g., DEMO-INTEROP.IO
). To configure io.Connect Desktop where to store app preferences, use the "store"
property of the "applicationPreferences"
top-level key in the system.json
file located in the %LocalAppData%/interop.io/io.Connect Desktop/Desktop/config
folder:
{
"applicationPreferences": {
"store": {
"type": "rest",
"restURL": "https://my-rest-service.com",
"restClientAuth": "no-auth",
"newDataCheckInterval": 2000
}
}
}
The "store"
object has the following properties:
Property | Type | Description |
---|---|---|
"newDataCheckInterval" |
number |
Interval in seconds at which to check for new data from the REST store. Executed only if subscribers are available. Defaults to 1800 . Valid only in "rest" mode. |
"restClientAuth" |
"no-auth" | "negotiate" | "kerberos" |
Authentication configuration. Valid only in "rest" mode. |
"restURL" |
string |
URL pointing to the app preferences store. Valid only in "rest" mode. |
"type" |
"file" | "rest" | "server" |
The type of the app preferences store. Set to "file" (default) to store and read app preferences from a local file. Set to "rest" to store and fetch app preferences from a REST service. Set to "server" to store and fetch app preferences from io.Manager. |
For more details, see the Developers > Configuration section and the system configuration schema.
For a reference implementation of a remote app preferences store, see the Node.js REST Config example. This basic implementation doesn't take the user into account and returns the same set of data for all requests. For instructions on running the sample server on your machine, see the README file in the repository.