Session Monitoring for Android App

⚙️ 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:

Item

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:

Problem

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:

When

During GermainUX initialization

At runtime after GermainUX has initialized

Use a stable, unique, non-sensitive value.

Do not use:

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

GermainAPM.setSessionId(
    "YOUR_MONITORING_SESSION_ID"
);

🍃 Kotlin

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:

Requirement

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:

System

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:

Attribute

Application and environment

Application version

Android version

Device manufacturer and model

User or role, when approved

Session duration

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:

Action

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:

Check

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:

Possible cause

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

The Germain Team can help you set this up. Contact GermainUX Support.


Component: Engine, Mobile App, RUM JS

Feature Availability: 2022.1 or later