Muokkaa

Jaa


Other Apache Cordova APIs

Important

Visual Studio App Center is scheduled for retirement on March 31, 2025. While you can continue to use Visual Studio App Center until it is fully retired, there are several recommended alternatives that you may consider migrating to.

Learn more about support timelines and alternatives.

Note

Support for Cordova Apps has ended in April 2022. Find more information in the App Center blog.

Adjust the log level

You can control the number of log messages that show up from App Center in the console. To adjust logging, open the project's config.xml file; for each of your Apache Cordova project's target platform elements (only Android and iOS today), add a child preference element in the following format:

<preference name="LOG_LEVEL" value="2" />

Set the value to one of the constants, described in the official Android documentation. The same constants can be used for iOS. To have as many log messages as possible, use VERBOSE (2) level.

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 reinstalled 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's 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 for the ID. Learn more in App Center's search documentation.

Note

The value for the user ID is limited to 256 characters. It will be shown with your crash reports but not used for aggregation or counts of affected users. In case you set user ID multiple times, only the last user ID will be used. You need to set the user ID yourself before each application launch, because this value isn't stored by the SDK between launches.