Migrate from the HockeySDK to App Center SDK for Cordova

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.

Follow this documentation if you're looking to update your application to use App Center SDK instead of HockeySDK.

1. Update the libraries

1.1 Remove old HockeySDK

  1. Open a terminal window, navigate to the Cordova project folder, and execute the following command:

    cordova plugin add cordova-plugin-appcenter-analytics
    
  2. Navigate to the Your app > platforms > android > platform_www > plugins folder and delete cordova-plugin-hockeyapp from it.

1.2 Add new App Center SDK

The App Center SDK is designed with a modular approach – you can integrate only those services that you're interested in. See the equivalences in the next table:

HockeyApp module App Center module Install command
Crashes and Exceptions Crashes cordova plugin add cordova-plugin-appcenter-crashes
Metrics Analytics cordova plugin add cordova-plugin-appcenter-analytics

Run one of the commands to install the module you need (or both).

2. Update the SDK setup code

2.1 Convert the application identifier

The App Center SDK uses application identifiers in the globally unique identifier (GUID) format. Your HockeyApp App ID can be used by App Center but you need to convert it to a different format. To convert the identifier, you must add four hyphens to get an 8-4-4-4-12 representation.

Before (HockeyApp): 00112233445566778899aabbccddeeff

After (App Center): 00112233-4455-6677-8899-aabbccddeeff

2.2 Replace SDK initialization in the application code

  1. Remove the HockeyApp initialization inside the deviceready handler:

    hockeyapp.start(null, null, "APP_ID");
    
  2. Configure the App Center SDK

    Open the Apache Cordova 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="APP_SECRET" value="{App Secret from the previous step}" />
    

    For more information, refer to App Center Cordova documentation.

  3. Replace all HockeyApp API calls throughout the application. The detailed API mapping tables are given below.

3. Services and feature comparison

Core

Feature HockeyApp App Center
Identify Users hockeyapp.setUserName or hockeyapp.setUserEmail AppCenter.setUserId

Analytics

Feature HockeyApp App Center
Automatically track sessions Documentation (can't be disabled) Documentation (enabled by default)
Track events hockeyapp.trackEvent Analytics.trackEvent

Crashes

Feature HockeyApp App Center
Automatically send crashes autoSend parameter (disabled by default) APPCENTER_CRASHES_ALWAYS_SEND (enabled by default)
Attach additional meta data hockeyapp.addMetaData Documentation (can be attached from listener)
Generate test crash hockeyapp.forceCrash AppCenter.Crashes.generateTestCrash
Display a dialog on crash ignoreDefaultHandler (disabled by default, Android only) AppCenter.Crashes.process (callback on processing a crash)

Version updates

App Center Distribute service isn't supported in App Center Cordova SDK yet.

Feedback Service

The feedback service won't be supported in App Center. See HockeyApp feedback.