Android API ReferencePermanent link for this heading

Since version 2013 Winter Release the Fabasoft app.telemetry SDK was extended to also support for mobile devices. In this case Java apps for Android can be instrumented using the Fabasoft app.telemetry SDK.

This SDK for Android is very similar to the basic Java SDK (see “Java API Reference”) with 2 exceptions:

  1. The data transport is HTTP-based. Instead of a shared-memory data communication with the app.telemetry agent as done by the native Java library, the mobile SDK uses HTTP-network calls to send and receive data to the WebAPI (which forwards the data to the agent).
  2. Most API-methods require a thread-token to be passed as additional parameter.

Additionally this mobile SDK provides a helper function to a screenshot from the device screen that could be sent with your feedback: APM.createScreenshot().

Prerequisites for Instrumenting Android Java AppsPermanent link for this heading

In order to use the Fabasoft app.telemetry SDK for mobile devices (Android) you will need an installation of Fabasoft app.telemetry (Server, Agent + WebAPI) and ensure that the WebAPI web service is reachable from your mobile device by checking the WebAPI status page of your installation (https://<your server>/web.telemetry). This installation will receive the telemetry data and will be used to configure the infrastructure (agent, log pools, etc.).

Before starting to develop anything for your mobile device, you will need a development environment for Android and all device drivers to communicate with your device.

Configuration for Android Java AppsPermanent link for this heading

The next required step is to include the Fabasoft app.telemetry SDK library for Android (softwaretelemetry-android.aar) as additional library into your project. This library is delivered with the app.telemetry installation media in the “Developer/Android” folder. The JavaDoc is next to the archive in a jar file (softwaretelemetry-android-javadoc.jar).

Instrumenting Android Java AppsPermanent link for this heading

The technical background for instrumenting any Java-based application is already described in chapter “Java API Reference”.

In order to initialize the SDK for your mobile app you need to pass the Android app “Context” and the target URL of your app.telemetry WebAPI instance.


static final String WEBAPI_URL = “http://<your server/web.telemetry”;
IAPMDataTransport transport = new MyDataTransport()
APM.init(this.getApplicationContext(), WEBAPI_URL, transport);
APMApplication app = APM
.RegisterApplication("Fabasoft app.telemetry", "Test Application", "Android", "Test 1");

The differences about how to use this API for an Android-based Java application can be obtained from the sample project.

Usage Example (




import android.os.Bundle;

import com.apptelemetry.apm.client.APM;

import com.apptelemetry.apm.client.APMModule;

import com.apptelemetry.apm.client.APMReportContent;

import com.apptelemetry.apm.client.IAPMDataTransport;

import com.apptelemetry.apm.client.IAPMDataTransportResponseCallback;

import android.view.View;

import android.widget.EditText;

import android.content.Intent;

public class MainActivity extends AppCompatActivity {

  APMModule moduleEvent;

  //change the following URL to YOUR app.telemetry server/WebAPI

  //it is the URL where the telemetry data and the feedback is sent to
static final String WEBAPI_URL = "https://<server>/web.telemetry";

protected void onCreate(Bundle savedInstanceState) {
APM.init(this.getApplication(), WEBAPI_URL, new MyDataTransport());
APM.RegisterApplication("Fabasoft app.telemetry", "Test Application",
"Android", "Test 1");
moduleEvent = APM.getModule("Event");
moduleEvent.RegisterEvent(1001, "sendFeedback", "message");
moduleEvent.RegisterEvent(1002, "secondThread", "message");
public void sendFeedback(View view) {
APMReportContent screenshot = APM.createScreenshot(view);
long thread = APM.CreateContextTx(0, "sendFeedback");
Intent intent = new Intent(this, FeedbackDialogActivity.class);
EditText editText = (EditText) findViewById(;
moduleEvent.EventStrTx(thread, 1001, APM.EVENT_LEVEL_NORMAL, APM.FLAG_ENTER, editText.getText().toString());
byte[] contextToken = APM.GetContextTx(thread);
long thread2 = APM.AttachContextTx(0, contextToken);
moduleEvent.EventStrTx(thread2, 1002, APM.EVENT_LEVEL_DETAIL, APM.FLAG_ENTER, editText.getText().toString());
moduleEvent.EventTx(thread2, 1002, APM.EVENT_LEVEL_NORMAL, APM.FLAG_LEAVE);
byte[] syncMark = APM.GetSyncMarkTx(thread2);
APM.SetSyncMarkTx(thread, syncMark);
String message = editText.getText().toString();
intent.putExtra(FeedbackDialogActivity.EXTRA_SCREENSHOT, screenshot);
intent.putExtra(FeedbackDialogActivity.EXTRA_TOPIC, message);
moduleEvent.EventTx(thread, 1001, APM.EVENT_LEVEL_NORMAL, APM.FLAG_LEAVE);

class MyDataTransport implements IAPMDataTransport {
public boolean isNetworkConnected() {
return true;
public boolean sendData(Uri uri, String contentType, byte[] bytes, IAPMDataTransportResponseCallback callback) {
// TODO: your implementation here
MyResponseObject response = sendHttpPostRequest(uri, contentType, bytes);
callback.dataSent(response.getStatus(), response.getContentType(), response.getResponseStream());
return true;