> ## Documentation Index
> Fetch the complete documentation index at: https://docs.germainux.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Monitoring for Android App

> The GermainUX Mobile App library initializes with default monitoring settings.

Components
[`Engine`](https://docs.germainux.com/main/germain-ux-engine)
[`Mobile App`](https://docs.germainux.com/main/germain-ux-mobile-app)
[`RUM JS`](https://docs.germainux.com/main/germain-ux-rum-js)

Availability
2022.1 or later

> **[Prerequisites](#prerequisites)**
>
> Items to confirm first

> **[Configure Automatic Monitoring](#configure-automatic-monitoring)**
>
> Enable or disable features

> **[Data to Review](#data-to-review)**
>
> Limit what gets collected

> **[Troubleshooting](#troubleshooting)**
>
> Resolve monitoring configuration issues

## Configure Android Application Monitoring

## Overview

The GermainUX Mobile App library initializes with default monitoring settings. Use `GermainAPMConfiguration` when the application requires custom settings, including:

* Application identity
* Data distribution frequency
* User context
* Crash and exception monitoring
* Application and system events
* Sessions

> **Show all 10**
>
> * Transactions
> * Fragments and views
> * Library logging
> * Data anonymization and exclusion

Configure the library before calling `GermainAPM.init()`.

## Prerequisites

Before configuration:

**1. Add the GermainUX Mobile App library to the Android project**

**2. Register the required permissions and service**

**3. Obtain the HTTPS ingestion URL for the GermainUX environment**

**4. Identify the application name and environment**

**5. Define privacy and data-retention requirements**

**6. Confirm which monitoring capabilities should be enabled**

**7. Test the configuration in a nonproduction build**

## Initialize with Custom Configuration

Create a `GermainAPMConfiguration`, apply the required settings, and pass it to `GermainAPM.init()`.

### Java

```java theme={null}
import android.app.Application;
import com.germainsoftware.apm.mobile.library.GermainAPM;
import com.germainsoftware.apm.mobile.library.GermainAPMConfiguration;

public class MonitoredApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        GermainAPMConfiguration config =
            new GermainAPMConfiguration(
                "https://YOUR_GERMAINUX_HOST/ingestion/fact"
            );

        config.getApp().setName("MyAndroidApplication");

        GermainAPM.init(this, config);
    }
}
```

### Kotlin

```python theme={null}
import android.app.Application
import com.germainsoftware.apm.mobile.library.GermainAPM
import com.germainsoftware.apm.mobile.library.GermainAPMConfiguration

class MonitoredApplication : Application() {

    override fun onCreate() {
        super.onCreate()

        val config = GermainAPMConfiguration(
            "https://YOUR_GERMAINUX_HOST/ingestion/fact"
        )

        config.app.name = "MyAndroidApplication"

        GermainAPM.init(this, config)
    }
}
```

Replace the sample endpoint and application name with values assigned to the monitored environment. Always use HTTPS in production.

Some Kotlin property syntax may differ between library releases. The equivalent Java-style getter and setter can be used if required.

## Configure the Application Identity

Assign a stable application name so Android telemetry is associated with the correct application in GermainUX.

The application name should distinguish the product but remain consistent across releases. Use separate environment attributes or configurations for development, test, staging, and production.

Avoid including a version number in the application name. The application version should remain a separate attribute so releases can be compared.

## Configure Data Distribution Frequency

By default, the library distributes collected telemetry approximately every 30 seconds. Crashes and application-closure events are sent as quickly as possible when Android gives the application enough time to do so.

Change the distribution frequency only when required.

### Java

```text theme={null}
GermainAPMConfiguration config =
    new GermainAPMConfiguration(
        "https://YOUR_GERMAINUX_HOST/ingestion/fact"
    );

config.setDistributionFrequency(60);

GermainAPM.init(this, config);
```

### Kotlin

```text theme={null}
val config = GermainAPMConfiguration(
    "https://YOUR_GERMAINUX_HOST/ingestion/fact"
)

config.setDistributionFrequency(60)

GermainAPM.init(this, config)
```

The value is expressed in seconds.

Consider the following when selecting a frequency:

* Required monitoring freshness
* Network usage
* Battery consumption
* Telemetry volume
* Expected session duration
* Mobile network reliability

Very short intervals can increase network activity and resource usage. Validate the selected value on representative devices and network conditions.

## Configure User Context

GermainUX can associate an application user with collected telemetry.

Set the user during initialization only when the identity is already known.

### Java

```text theme={null}
config.setUser(
    "PSEUDONYMOUS_USER_ID",
    "DEPARTMENT",
    "ROLE"
);
```

### Kotlin

```text theme={null}
config.setUser(
    "PSEUDONYMOUS_USER_ID",
    "DEPARTMENT",
    "ROLE"
)
```

Department and role are optional.

If the user becomes known only after authentication, set the context at runtime:

### Java

```text theme={null}
GermainAPM.setUser(
    "PSEUDONYMOUS_USER_ID",
    "DEPARTMENT",
    "ROLE"
);
```

### Kotlin

```text theme={null}
GermainAPM.setUser(
    "PSEUDONYMOUS_USER_ID",
    "DEPARTMENT",
    "ROLE"
)
```

Use a stable pseudonymous identifier where possible. Do not send passwords, authentication tokens, payment information, or unnecessary personal data.

Ensure that user context is updated appropriately when the application changes users.

## Configure Automatic Monitoring

`GermainAPMConfiguration` provides settings for enabling or disabling monitoring features.

For example, automatic unhandled-exception monitoring can be disabled when the application uses another crash handler or requires custom control:

```text theme={null}
config.setAutomaticUnhandledExceptionsMonitoring(false);
```

Review the child configuration pages for detailed instructions covering:

* Error and Exception Monitoring
* Application and System Event Monitoring
* Session Monitoring
* Transaction Monitoring
* Fragment and View Monitoring

Enable only the telemetry required for the monitoring objectives.

When modifying crash handling, confirm that GermainUX and any other crash library do not prevent each other from receiving unhandled exceptions.

## Configure Library Logging

The GermainUX library can write initialization and diagnostic messages to Logcat. Disable library logging when it is unnecessary in production.

### Java

```text theme={null}
GermainAPMConfiguration config =
    new GermainAPMConfiguration(
        "https://YOUR_GERMAINUX_HOST/ingestion/fact"
    );

config.disableLogging();

GermainAPM.init(this, config);
```

### Kotlin

```text theme={null}
val config = GermainAPMConfiguration(
    "https://YOUR_GERMAINUX_HOST/ingestion/fact"
)

config.disableLogging()

GermainAPM.init(this, config)
```

Review Logcat output during development to verify initialization, connectivity, and configuration. Do not write credentials, tokens, or sensitive monitoring values to Logcat.

## Configure Data Anonymization and Exclusion

Use `addExclusion()` to remove or anonymize configured fields before telemetry is distributed.

The method has the following signature:

```text theme={null}
public void addExclusion(
    String name,
    String fieldName,
    String factType,
    String pattern,
    boolean preserveLength,
    boolean preserveWhitespace,
    boolean anonymize
);
```

| Parameter | Description |
| - | - |
| `name` | Unique name for the privacy rule |
| `fieldName` | Field to which the rule applies |
| `factType` | Optional fact type; empty applies the rule more broadly |
| `pattern` | Optional pattern used to match part of the value |
| `preserveLength` | Preserves the original value length when masking |
| `preserveWhitespace` | Preserves whitespace when masking |
| `anonymize` | Anonymizes the matching value instead of retaining it |

### Example

```text theme={null}
GermainAPMConfiguration config =
    new GermainAPMConfiguration(
        "https://YOUR_GERMAINUX_HOST/ingestion/fact"
    );

config.addExclusion(
    "User Name",
    "user.name",
    null,
    null,
    true,
    true,
    false
);

config.addExclusion(
    "Device ID",
    "device.id",
    null,
    null,
    false,
    false,
    true
);

GermainAPM.init(this, config);
```

Kotlin:

```text theme={null}
val config = GermainAPMConfiguration(
    "https://YOUR_GERMAINUX_HOST/ingestion/fact"
)

config.addExclusion(
    "User Name",
    "user.name",
    null,
    null,
    true,
    true,
    false
)

config.addExclusion(
    "Device ID",
    "device.id",
    null,
    null,
    false,
    false,
    true
)

GermainAPM.init(this, config)
```

Test every privacy rule to confirm that it affects the intended field and fact type. Field names and supported fact types can vary by library version.

## Data to Review

Before production deployment, review whether the configuration can collect:

* User identifiers
* Device identifiers
* Application and device attributes
* Error messages
* Exception stack traces
* Screen and fragment names

> **Show all 11**
>
> * Transaction names and attributes
> * Custom events
> * Network-related values
> * Location or geographic information
> * Form or message content

Collect only information necessary for monitoring and support.

## Configure GermainUX Analytics

After application-side configuration, verify the corresponding GermainUX settings:

### Application and KPIs

Confirm that:

* The Android application is enabled.
* Mobile KPIs are enabled.
* Application and environment names match the SDK configuration.
* Custom transaction and event categories are mapped correctly.

### Analytics

Go to **Workspace > Analytics** to configure:

* KPIs
* Business Processes
* Categorization
* Correlation
* Data Privacy
* Rules
* SLAs

### Dashboards and reports

Go to **Workspace > Dashboards > All** to locate or create Android application dashboards.

Configure reports for:

* Application usage
* Crashes and exceptions
* Launch and transaction performance
* Device and operating-system breakdown
* Business-process completion
* Release comparison

### Alerts

Configure alerts for:

* New or increased crashes
* Repeated exceptions
* Slow application launches
* Slow or failed transactions
* Business-process failures
* Application-version regressions
* Missing expected telemetry

## Validation

After applying the configuration:

**1. Build and install the test application**

**2. Confirm that GermainUX initializes successfully**

**3. Verify the application name and environment**

**4. Create a user session**

**5. Set or update the user context**

**6. Navigate through representative screens and fragments**

**7. Execute configured transactions**

**8. Send a controlled handled exception**

**9. Test crash collection in a safe environment**

**10. Confirm that distribution occurs at the configured frequency**

**11. Verify that excluded and anonymized values are protected**

**12. Test with release-mode shrinking and obfuscation**

**13. Confirm that dashboards, alerts, and reports receive the expected data**

## Troubleshooting

### Initialization fails

Verify:

* The library is packaged in the application.
* The ingestion URL is correct and uses HTTPS.
* The required Android permissions are present.
* The GermainUX service is registered.
* The application class is registered in the manifest.
* The installed library version supports the configuration methods being used.

### No data appears in GermainUX

Check:

* Device network connectivity
* TLS and certificate validation
* Firewall, proxy, VPN, or mobile-device policies
* Application and environment configuration
* Distribution frequency
* GermainUX data privacy and processing rules
* Library diagnostic output in a test build

### User context is missing

Confirm that:

* `setUser()` executes after the user is identified.
* The value is not empty.
* Privacy rules do not remove the field.
* The user is set again after application or authentication-state changes when necessary.

### Privacy rules do not apply

Verify:

* Field name
* Fact type
* Matching pattern
* Capitalization
* Exclusion configuration order
* Installed library version

## Get Help

> **[Contact GermainUX Support](https://docs.germainux.com/main/support.md)**
>
> The Germain Team can help you set this up.

> **Can't find what you need?**
>
> Search all GermainUX docs with **Ctrl + K**, or use the feedback buttons at the bottom of this page to tell us what is missing.

The content of this document is proprietary to GERMAIN SOFTWARE.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.