Other Apache Cordova APIs

Disable all services at runtime

If you want to disable all App Center services at once, use the setEnabled() API. When disabled, the SDK will not forward any information to App Center.

await AppCenter.setEnabled(false);

To enable all services at once again, use the same API but pass true as a parameter.

await AppCenter.setEnabled(true);

Change state of service in runtime

You can enable or disable desired service at the runtime with following code:

await AppCenter.Analytics.setEnabled(false);

Note

This method should only be used after AppCenter is started.

Check if App Center is enabled

You can also check if App Center is enabled or not.

const enabled = await AppCenter.isEnabled();

Identify installations

The App Center SDK creates a UUID for each device once the app is installed. This identifier remains the same for a device when the app is updated and a new one is generated only when the app is re-installed or the user manually deletes all app data. The following API is useful for debugging purposes.

var success = function(installId) {
    console.log("Install ID: " + installId);
}

var error = function(error) {
    console.error(error);
}
AppCenter.getInstallId(success, error);

Identify users

The App Center SDK supports setting a user ID that is used to augment crash reports. To use this capability:

  1. Configure the App Center SDK as described in the App Center SDK Getting started guide.
  2. Set a userID in the SDK using the following code:
AppCenter.setUserId("your-user-id");

After setting a user ID, you can use App Center's search feature to search for specific crash reports associated with the ID. Learn more in App Center's search documentation.

Note

Note that the value for the user id is limited to 256 characters.