> ## 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.

# Session Monitoring for Android App

> GermainUX automatically generates a session ID and associates it with telemetry collected during an Android application session.

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

> **[Automatic Session Identification](#automatic-session-identification)**
>
> Sessions tracked without setup

> **[Session-ID Requirements](#session-id-requirements)**
>
> Rules for custom session IDs

> **[Analyze Sessions](#analyze-sessions)**
>
> Find what happened before errors

> **[Troubleshooting](#troubleshooting)**
>
> Fix missing session data

## Configure Session Monitoring for an Android Application

## Overview

GermainUX automatically generates a session ID and associates it with telemetry collected during an Android application session.

The session ID enables GermainUX to correlate:

* Application lifecycle events
* Screens, views, and fragments
* Transactions
* Errors and exceptions
* Crashes
* Device and application context
* Custom events
* Business-process activity

Most applications should use the session ID generated by GermainUX. Configure a custom session ID only when it is required to correlate GermainUX telemetry with an existing application or cross-system session.

## Automatic Session Identification

No additional configuration is required to use automatic session identification.

After the GermainUX Mobile App library initializes, it generates and assigns a session ID to collected telemetry.

Automatic identification avoids:

* Duplicate session IDs
* Reuse of expired application sessions
* Exposure of authentication-session values
* Inconsistent session boundaries
* Missing identifiers during application startup

## Configure a Custom Session ID

A custom session ID can be assigned:

* During GermainUX initialization
* At runtime after GermainUX has initialized

Use a stable, unique, non-sensitive value.

Do not use:

* Passwords
* Authentication or refresh tokens
* Session cookies
* Access tokens
* Email addresses
* Personal information
* Predictable identifiers that create a security risk

A monitoring correlation ID should be separate from the credential used to authenticate the user.

## Set the Session ID During Initialization

Set the ID through `GermainAPMConfiguration` when it is already available during application startup.

### 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.setSessionId(
            "YOUR_MONITORING_SESSION_ID"
        );

        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.setSessionId(
            "YOUR_MONITORING_SESSION_ID"
        )

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

Replace the sample value with the application-generated correlation ID.

## Set the Session ID at Runtime

If the session ID becomes available after initialization, assign it using `GermainAPM.setSessionId()`.

### Java

```text theme={null}
GermainAPM.setSessionId(
    "YOUR_MONITORING_SESSION_ID"
);
```

### Kotlin

```text theme={null}
GermainAPM.setSessionId(
    "YOUR_MONITORING_SESSION_ID"
)
```

Set the ID before collecting the events or transactions that must be associated with it.

For example, an application may initially use the GermainUX-generated session ID and assign an application correlation ID after authentication or after a business session begins.

## Session-ID Requirements

A custom session ID should be:

* Unique for each intended session
* Stable throughout that session
* Different when a new session begins
* Free of personal or confidential information
* Available to every event that must be correlated
* Consistent across systems when cross-system correlation is required

Do not reuse a single static value across users, devices, or application launches.

If multiple users can use the application on the same device, update the session and user context whenever the active application session changes.

## User and Session Identification

The user ID and session ID serve different purposes:

| Identifier | Purpose |
| - | - |
| User ID | Associates activity with a user across sessions |
| Session ID | Associates related activity within one application session |
| Transaction or correlation ID | Connects a specific operation across application and backend systems |

Use pseudonymous values where possible. Do not place user-identifying information inside the session ID if it can be stored separately under approved privacy controls.

## Cross-System Correlation

A custom session ID can help correlate Android telemetry with:

* Application APIs
* Backend services
* Integration platforms
* Logs
* Business transactions
* Support or diagnostic records

For reliable correlation:

**1. Propagate an approved correlation ID through the relevant requests**

**2. Capture that identifier in each monitored system**

**3. Keep clocks synchronized**

**4. Avoid changing the ID during an active transaction**

**5. Do not expose security credentials as correlation identifiers**

A mobile session may contain many backend requests and business transactions. Use transaction-level correlation IDs when a session ID is too broad.

## Analyze Sessions

In GermainUX, sessions can be analyzed by:

* Application and environment
* Application version
* Android version
* Device manufacturer and model
* User or role, when approved
* Session duration

> **Show all 11**
>
> * Screens and fragments visited
> * Transactions
> * Errors and crashes
> * Business-process completion
> * Network or device context

Session analysis helps determine what happened before an error, where users abandoned a workflow, and which releases or devices are associated with poor experiences.

## Privacy

Before configuring session identification:

* Use random or pseudonymous identifiers.
* Do not use authentication tokens.
* Avoid embedding user names or email addresses.
* Apply anonymization and exclusion rules.
* Restrict access to session-level data.
* Define an appropriate retention period.
* Review correlation fields in custom events, errors, and network telemetry.

Session IDs should support analysis without granting access to the application or exposing the user’s credentials.

## Validation

After configuring session monitoring:

**1. Start the application and generate a session**

**2. Confirm that collected events contain a session ID**

**3. Navigate across multiple screens**

**4. Execute a transaction**

**5. Generate a controlled handled exception**

**6. Verify that all events appear under the expected session**

**7. Start a new application session**

**8. Confirm that it does not reuse the previous session ID unintentionally**

**9. Test runtime assignment if the ID is set after initialization**

**10. Verify that the ID contains no sensitive information**

## Troubleshooting

### Telemetry has no session ID

Verify that:

* GermainUX initialized successfully.
* The session ID is not empty.
* `setSessionId()` executes before the relevant telemetry is collected.
* Privacy rules do not remove the field.
* The installed library supports the configured API.

### Multiple users appear in one session

Confirm that the application updates the user and session context when the active user changes. Do not reuse identifiers across login, logout, or account-switching boundaries.

### One user journey is split across sessions

Check whether:

* The application process restarted.
* A new custom session ID was assigned.
* Different application processes use different configurations.
* Offline telemetry was received later.
* The application and backend use different correlation values.

### ⁉ Sessions from different users are combined

Verify that the custom session ID is unique and not a hard-coded, user-level, device-level, or globally shared value.

## 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.