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.

App Preferences Stores

App preferences can be stored locally in a file or remotely by using a REST service or io.Manager.

To define a location for storing app preferences, use the "store" property of the "applicationPreferences" top-level key in the system.json system configuration file of io.Connect Desktop.

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. Valid only in "rest" mode. Defaults to 1800.
"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. Required if "type" is set to "rest".
"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.

Local

By default, app preferences are stored locally in the <installation_location>/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 instruct io.Connect Desktop to store app preferences in a local file, set the "type" property of the "store" object to "file":

{
    "applicationPreferences" : {
        "store": {
            "type": "file"
        }
    }
}

REST

App preferences can also be obtained from remote app preferences stores via a REST service.

ℹ️ For a reference implementation of a remote app preferences store, see the Node.js REST Config example.

To configure a connection to the REST service providing the app preferences store, set the "type" property of the "store" object to "rest" and provide the URL of the REST service:

{
    "applicationPreferences": {
        "store": {
            "type": "rest",
            "restURL": "https://my-rest-service.com/app-preferences",
            "restClientAuth": "no-auth",
            "newDataCheckInterval": 2000
        }
    }
}

The remote store must return an AppPreferences object as a response.

io.Manager

You can also use io.Manager for hosting and retrieving app preferences.

To configure io.Connect Desktop to fetch app preferences from io.Manager, set the "type" property of the "store" object to "server":

{
    "applicationPreferences" : {
        "store": {
            "type": "server"
        }
    }
}

ℹ️ For details on how to configure io.Connect Desktop to connect to io.Manager, see the io.Manager section.