Installing the Android SDK

Installing via Gradle

In the build.gradle file living in the projectname/app directory, add the Workspace ONE Intelligence repository information in repositories{...}

maven {
    url 'https://vmwaresaas.jfrog.io/artifactory/Workspace-ONE-Intelligence-SDK-Android/'
}

In the build.gradle file living in the projectname/app directory, add the Workspace ONE Intelligence dependency information in dependencies{...}

compile 'com.crittercism:crittercism-android-agent:+'

or, for the NDK agent:

compile 'com.crittercism:crittercism-android-ndk-agent:+'

Be sure to sync your project with your gradle files after you add this!

Installing Manually

  1. Download the Android SDK. You must choose between the standard SDK and the NDK-enabled SDK.

  2. Copy the Workspace ONE Intelligence JAR file to your libs folder.

  3. If you are using gradle, ensure that your dependency information in dependencies{...} includes jars in your libs folder:

compile fileTree(dir: 'libs', include: ['*.jar'])
  1. If you’re using Eclipse, right click your project, click Properties, select Java Build Path, click Add External Jar, and then add the Workspace ONE Intelligence JAR file.

Setting Up the Manifest

Add the following permissions to your app’s AndroidManifest.xml file.

INTERNET

Required. Used to report data to Workspace ONE Intelligence.

ACCESS_NETWORK_STATE

Optional. Allows providing network connectivity information such as carrier and network type.

<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="3"
    android:versionName="1.0"
    package="com.crittercism.demo"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application android:icon="@drawable/icon"
        android:label="@string/app_name" android:name=".DemoApp">

        <activity android:label="@string/app_name" android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

    </application>
</manifest>

For more information on these permissions, refer to the Android Manifest documentation

Initializing Workspace ONE Intelligence SDK

The following initialization instructions are the same for both the standard (sdkonly) SDK and the NDK-enabled SDK.

Obtain your app ID from Workspace ONE Intelligence console.

  1. To initialize Workspace ONE Intelligence SDK add the following code at the beginning of the onCreate() of your main Activity:

Crittercism.initialize(getApplicationContext(), "CRITTERCISM_APP_ID");

Note

Workspace ONE Intelligence SDK should be initialized once on the main thread as early as possible. Hence, if you subclass the Application singleton, you should initialize Workspace ONE Intelligence SDK in the onCreate() of that Application subclass using the same code, instead of the main activity. App loads will be sent from the first visible activity; they will not be sent from background services and BroadcastReceivers.

Note

Your main Activity is the one with android.intent.action.MAIN intent filter in your AndroidManifest.

  1. You may need to add the following import, if Android Studio has not automatically added it already:

import com.crittercism.app.Crittercism;

Your Android app is now integrated with Workspace ONE Intelligence and you can go ahead and build it. Additional features require adding more code to your project.

Configuring Proguard Symbolication

Symbolication is the process of translating stack traces into a human-readable form by mapping hexadecimal addresses to function names using symbol file(s). Workspace ONE Intelligence automatically symbolicates crashes once you have uploaded your app’s symbol file(s).

Note

Follow the instructions in this section only if your app obfuscates with Android Proguard. Otherwise, skip this section.

For Android applications, developers have the option to obfuscate their function names using the ProGuard tool in order to reduce app size and to prevent others from reverse engineering the app source. In order to replace the obfuscated name with a human-readable name, developers use a Proguard mapping file.

Setting Up ProGuard

  1. To build a project with Workspace ONE Intelligence SDK, place the Workspace ONE Intelligence JAR in the libs/ directory of your project.

  2. Add the following lines to your project’s proguard.cfg file:

-dontwarn com.crittercism.**
-keep public class com.crittercism.**
-keepclassmembers public class com.crittercism.**
{
    *;
}
  1. To get line number information, make sure that you keep the file names and line numbers in your ProGuard .cfg settings file.

-keepattributes SourceFile, LineNumberTable

This information will be visible in all stacktraces, however - even those that are not symbolicated.

To have your crashes automatically deobfuscated and grouped, you must upload a mapping.txt file on to the Settings tab of your App.

Each mapping.txt file you upload is associated with a version of your app. We deobfuscated crashes for only one version with each mapping.txt file.

Note

Be careful to upload the right file for your version!

Note

If you set a customized app version name in the CrittercismConfig instance, you should use that string and not the manifest string in app-version-name. Also, if you choose to include the app version code in the app version, that should also be included in app-version-name.

Note

At this point, you have enabled Workspace ONE Intelligence SDK to receive Application Performance Information from your application