Use the Aternity Android SDK to Embed Monitoring in an Android App

To add monitoring to your Android app, integrate the Aternity Android Mobile SDK into the app, and then initialize and perform common monitoring tasks with the API. A monitored mobile app is a regular iOS or Android app which has Aternity's monitoring functionality inside, enabling it to report performance statistics like launch times, errors, crashes, network traffic, and also custom activities performance, and some surrounding data on the underlying mobile device and user. This article describes how to

With the Mobile SDK you can insert API calls to fine-tune the monitoring, by dynamically setting properties (like the device name, location), or tag events for use in some types of custom activities, or you can use APIs to report breadcrumbs for later troubleshooting of crashes.

A custom activity for mobile apps starts and ends when the app reports specific events which match the events of an activity's signature file. If Aternity already reports these events by default, you do not need to add manual API calls. However, for some custom activities, you must manually tag and report those events using API calls.

For example, to measure the response time between the start of a login and its response, if those events are not automatically reported, insert an API to tag the login action, and add another API call to tag its response. When you report each tag to Aternity, the system matches them to the custom activity already in place, and then reports the response time in the dashboards. To create your own custom activities, contact Customer Services.

Before you begin

Ensure your app compiles and builds cleanly with no errors, and runs on a simulator or a mobile device.

Before embedding Aternity's monitoring into an Android mobile app, verify your Mac conforms to the following minimum system requirements (Aternity Android Wrapper or Aternity Android Mobile SDK):

Attribute Requirement (Android Wrapper and Aternity Android SDK)

Operating system

Mac OS X 10.7 or later.

Java Developer Kit

JDK 1.8 or later.

Programming environment

Google Android Studio or a standalone Android SDK.

Using the SDK Manager, install the latest Android SDK tools (platform tools and build tools) for SDK Platform API level 16 or newer.

Connectivity

Internet access.

App resource usage

When you add Aternity functionality to an Android app:

  • Disk storage barely changes at all.

  • RAM size is an extra 5-10MB.

  • CPU usage rises by 1%.

Procedure

  1. Step 1 Integrate the Aternity Android Mobile SDK into your app development environment. For details, see Integrate and Initialize the Aternity Android SDK into your App.

    Part of integrating the Aternity Android SDK into the app requires initializing it. For full details of the init method in Aternity Android SDK, see Initialize the Aternity Android SDK Manually (init).

  2. Step 2 Whenever a class uses the Aternity Android SDK API methods, you must add the statement:
    import com.aternity.sdk.Aternity;
    Add an import statement whenever a class uses the API
  3. Step 3 You can set any of the defined monitoring parameters with the API. For example: