Skip to main content
Hero background

BLACKBERRY DEVELOPERS

Get Started with BlackBerry Analytics SDK for Android

Integrate BlackBerry Analytics into Android iOS Dynamics apps with prerequisites, entitlements, and SDK setup guidance.

Before you begin: BlackBerry Analytics can only be integrated with BlackBerry Dynamics apps. For more information on BlackBerry Dynamics apps , see Getting Started with BlackBerry Dynamics SDK.

  1. Go to the downloads page to download the BlackBerry Analytics SDK for Android or iOS.

  2. Complete the following steps to verify that you are entitled to the BlackBerry Analytics app:

    1.  Log in to the BlackBerry UEM management console.

    2. Click Apps.

    3. Search for BlackBerry Analytics.

If you are entitled to use BlackBerry Analytics, the BlackBerry Analytics app appears in the app list. If you do not see the BlackBerry Analytics app in the app list, you must contact your BlackBerry representative to request entitlement.

Install and Configure

1. In the UEM management console, click Users and select the user.

 

2. In the Apps section, click the plus icon.

3. Search for and select the BlackBerry Analytics entitlement.

4. Click Next.

5. In the Disposition drop-down list, select Required.

6. Click Assign.

Develop and Deploy

  1. Extract the downloaded BlackBerry Analytics SDK.

  2. Copy BlackBerryAnalytics-release.aar to the libs directory.

  3. Add the following dependency in the module gradle file:
    compile(name:'BlackberryAnalytics-release', ext:'aar')

  4. Declare the libs directory as a repository in the project gradle file.
    flatDir { dirs 'libs' }

  5. Create a new class which has a superclass android.app.Application.

 

6. Change the android.name property of the application in the manifest file to the new class create in the last step.

7. Import BlackBerry Analytics SDK package in the new class.

  import com.blackberry.analytics.analyticsengine.BlackberryAnalytics

8. Override the onCreate() method to initialize the BlackBerry Analytics.

  BlackberryAnalytics.setStage(this.getApplication());

It takes 24 hours for the data to be updated on the BlackBerry Analytics Dashboard.

Custom Events

The BlackBerry Analytics Library introduces two APIs to track custom events in apps.

The BlackBerry Analytics Library introduces two APIs to track custom events in apps.

The following events are provided to use with APIs to track metrics.

  • Paired Events(Feature Active/Inactive) : These events provide the time slices to track the start/open or end/close events of specific task/feature.

  • Single Events (Adoption Event): This event uniquely represents a specific event/task that should be tracked in the portal.

Feature Active and Feature Inactive events are confined to the visible life cycle of the app. When the app moves to the background, the BlackBerry Analytics SDK marks all of the current active features as inactive features. Features that were active prior to the app going to the background will no longer be tracked as active features after the app moves to the foreground. The app will have to mark a feature as active when it is in the foreground again. Also, apps may need to call the trackFeatureEvent API to record Feature Inactive events when the apps view/screen is switched to different view/screen.

 
Event Type
Android
(AnalyticsEvent)
 
Description
FeatureActive
FEATURE_ACTIVE
To record feature active event
FeatureInactive
FEATURE_INACTIVE
To record feature inactive event
AdoptionEvent
ADOPTION_EVENT
To record adoption event.

 AnalyticsResponse response =
BlackberryAnalytics.trackFeatureEvent(AnalyticsEvent.FEATURE_ACTIVE, "EventName");

AnalyticsResponse response = BlackberryAnalytics.trackFeatureEvent(AnalyticsEvent.FEATURE_INACTIVE, "EventName");

AnalyticsResponse response = BlackberryAnalytics.trackApplicationEvent(AnalyticsEvent.ADOPTION_EVENT, "eventValue", "
eventKey");

You can see custom events under Feature Tracking tab when you select your app under Apps on the left navigation bar.

Congratulations on adding BlackBerry Analytics to your secure app!