Skip to main content
Skip table of contents

Configuration for Android App Monitoring

In addition of the initialization and auto-configuration we allow customer to define custom configuration and enable/disable monitoring components. Please review GermainAPMConfiguration documentation for complete list of options and setters.

Initialization with custom configuration:

Java:

JAVA
public class SampleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
		GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact"); 
		// custom config code here
		// e.g. config.getApp().setName("MyAppName");
		// e.g. config.setAutomaticUnhandledExceptionsMonitoring(false);
        GermainAPM.init(this, config);
    }

}

Kotlin:

JAVA
class SampleApplication: Application() {

  override fun onCreate() {
    super.onCreate()
    GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact")
	// custom config code here
	// e.g. config.getApp().setName("MyAppName")
	// e.g. config.setAutomaticUnhandledExceptionsMonitoring(false)
    GermainAPM.init(this, config)
  }

}

Distribution frequency

By default Germain UX monitoring sends data back to the Germain UX Server every 30 seconds (except crashes and application closure events which, if possible, we try to send as soon as they occur). You can update this frequency by setting distributionFrequency:

Java:

JAVA
public class SampleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
		GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact");
		config.setDistributionFrequency(YOUR_VALUE_IN_SECONDS);
        GermainAPM.init(this, config);
    }

}

Kotlin:

JAVA
class SampleApplication : Application() {

  override fun onCreate() {
    super.onCreate()
    GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact")
	config.setDistributionFrequency(YOUR_VALUE_IN_SECONDS)
    GermainAPM.init(this, config)
  }

}

Application user 

There are 2 way to associate application's user name with collected data.

During Germain UX initialization through GermainAPMConfiguration:

Java:

JAVA
public class SampleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
		GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact");
		config.setUser("USER_NAME","USER_DEPARTMENT", "USER_ROLE"); // department and role are optional
        GermainAPM.init(this, config);
    }

}

Kotlin:

JAVA
class SampleApplication : Application() {

  override fun onCreate() {
    super.onCreate()
	GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact")
	config.setUser("USER_NAME","USER_DEPARTMENT", "USER_ROLE") // department and role are optional
    GermainAPM.init(this, config)
  }

}

On application runtime after GermainAPM initiated:

Java:

JAVA
	//
	GermainAPM.setUser("USER_NAME","USER_DEPARTMENT", "USER_ROLE"); // department and role are optional
	//

Kotlin:

JAVA
	//
	GermainAPM.setUser("USER_NAME","USER_DEPARTMENT", "USER_ROLE") // department and role are optional
	//

Logging output

By default logcat logging (INFO level only) is enabled when Germain UX Library gets initiated. You can disable it completely with the following configuration:

Java:

JAVA
public class SampleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
		GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact");
		config.disableLogging();
        GermainAPM.init(this, config);
    }

}

Kotlin:

JAVA
class SampleApplication : Application() {

  override fun onCreate() {
    super.onCreate()
	GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact")
	config.disableLogging()
    GermainAPM.init(this, "http://GERMAIN_APM_SERVER/ingestion/fact")
  }

}

Data anonymization and exclusion 

You can anonymize and/or exclude certain data fields by providing additional configuration on init via addExclusion method call on GermainAPMConfiguration.  It has the following declaration:

JAVA
/**
 * @param name Unique name of this exclusion
 * @param fieldName Field name, example="user.name"
 * @param factType Fact type this exclusion applies to. If empty, this exclusion applies to all types, example="MobileEvent"
 * @param pattern Pattern to optionally match exclusion value, example="User: (.*)"
 * @param preserveLength If true, will preserve length of original value when masking
 * @param preserveWhitespace If true, will preserve whitespace characters when masking
 * @param anonymize If true, will anonymize value
*/
public void addExclusion(String name, String fieldName, String factType, String pattern, boolean preserveLength, boolean preserveWhitespace, boolean anonymize);

Examples:

Java:

JAVA
public class SampleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
		GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact");
        // example of excluding user name
		config.addExclusion("User Name", "user.name", null, null, true, true, false);
        // example of anonynimize device id
		config.addExclusion("Device Id", "device.id", null, null, false, false, true);
        GermainAPM.init(this, config);
    }

}

Kotlin:

JAVA
class SampleApplication : Application() {

  override fun onCreate() {
        super.onCreate()
		GermainAPMConfiguration config = new GermainAPMConfiguration("http://GERMAIN_APM_SERVER/ingestion/fact")
        // example of excluding user name
		config.addExclusion("User Name", "user.name", null, null, true, true, false)
        // example of anonynimize device id
		config.addExclusion("Device Id", "device.id", null, null, false, false, true)
        GermainAPM.init(this, config)
  }

}

Component: Mobile App

Feature Availability: 8.6.0 or later

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.