@capacitor-community/appcenter

Capacitor Plugin for Microsoft's App Center SDK.

Usage no npm install needed!

<script type="module">
  import capacitorCommunityAppcenter from 'https://cdn.skypack.dev/@capacitor-community/appcenter';
</script>

README


App Center

@capacitor-community/appcenter

Capacitor Plugin for Microsoft's Visual Studio App Center SDK. Contains additional helper APIs suitable for some projects.

Maintainers

Maintainer GitHub Social
John Borges johnborges @johnborges

Features

  • Adjusting the Log Level
  • Identify Users and Installations
  • Control SDK Services
  • Set Custom Properties

Install

npm install @capacitor-community/appcenter
npx cap sync

Usage

import AppCenter from '@capacitor-community/appcenter';

const appCenterInfo = async () => {

  try {
    const { value: sdkEnabled } = await AppCenter.isEnabled()
    const { value: installId } = await AppCenter.getInstallId()
    const { value: sdkVersion } = await AppCenter.getSdkVersion()
    const { value: logLevel } = await AppCenter.getLogLevel()

    console.debug(sdkEnabled);
    console.debug(installId);
    console.debug(sdkVersion);
    console.debug(logLevel);
  } 
  catch (error) {
    console.error(error)
  }

}

API

getInstallId()

getInstallId() => any

Returns AppCenter unique installation identifier.

Returns: any

Since: 0.0.1


setUserId(...)

setUserId(options: { userId: string; }) => any

Set a user ID that's used to augment crash reports.

Param Type Description
options { userId: string; } Ex. "your-user-id"

Returns: any

Since: 0.0.1


getSdkVersion()

getSdkVersion() => any

Get the version of the native App Center SDK

Returns: any

Since: 0.0.1


isEnabled()

isEnabled() => any

Check if App Center is enabled or not as a whole.

Returns: any

Since: 0.0.1


setEnabled(...)

setEnabled(options: { enabled: boolean; }) => any

Toggle all App Center services at runtime. When disabled, the SDK won't forward any information to App Center.

Param Type
options { enabled: boolean; }

Returns: any

Since: 0.7.0


setCustomProperties(...)

setCustomProperties(options: { properties: CustomProperties; }) => any

App Center allows you to define custom properties as key value pairs in your app. You may use custom properties for various purposes. For instance, you can use custom properties to segment your users, and then send push notifications to a specific audience.

Param Type
options { properties: CustomProperties; }

Returns: any

Since: 0.2.0


getLogLevel()

getLogLevel() => any

Returns currently set LogLevel.

Returns: any

Since: 0.2.0


setLogLevel(...)

setLogLevel(options: { logLevel: LogLevel; }) => any

You can control the amount of log messages that show up from App Center in the console. Log messages show in the console on iOS and LogCat on Android. By default, it's set to Assert for the App Store environment and Warning otherwise. To have as many log messages as possible, use Verbose. Note: setLogLevel API can't increase logging for app startup code, before JavaScript is loaded.

Param Type
options { logLevel: LogLevel; }

Returns: any

Since: 0.2.0


setNetworkRequestsAllowed(...)

setNetworkRequestsAllowed(options?: { isAllowed: boolean; } | undefined) => any

Set whether SDK can send network requests.

Param Type
options { isAllowed: boolean; }

Returns: any

Since: 0.6.0


isNetworkRequestsAllowed()

isNetworkRequestsAllowed() => any

Check whether sending data in the App Center SDK is allowed or not.

Returns: any

Since: 0.6.0


Enums

LogLevel

Members Value
VERBOSE 2
DEBUG 3
INFO 4
WARNING 5
ERROR 6
ASSERT 7
NONE 99