Network Change Instrumentation
Generates: Events
Automatically detects network connectivity changes.
How It Works
The network change instrumentation monitors network connectivity using Android's ConnectivityManager.NetworkCallback. It generates telemetry when network changes are detected, such as switching from WiFi to cellular or losing connectivity.
This instrumentation only generates telemetry when the application is in the foreground, not when backgrounded.
Configuration
Network change detection is enabled by default when using the Android agent. It's automatically included when network attributes are enabled.
What Gets Tracked
- Network connectivity changes (lost, available)
- Connection type (wifi, cellular, wired, vpn, etc.)
- Network subtype (LTE, 5G, etc.) - requires permissions
- Carrier information (name, MCC, MNC, ICC) - requires permissions
Generated Telemetry
Type: Log Record (Event)
Body: Network change description
pulse.type: network.change
Attributes
Network Change Attributes
| Attribute | Description | Example | Always Present |
|---|---|---|---|
pulse.type | Instrumentation type | "network.change" | ✅ Yes |
network.status | Network status | "available", "lost" | ✅ Yes |
network.connection.type | Connection type | "wifi", "cell", "wired", "vpn", "unavailable" | ✅ Yes |
network.connection.subtype | Connection subtype | "LTE", "5G", "wifi" | ⚠️ Requires permission* |
network.carrier.name | Carrier name | "Verizon", "T-Mobile-US" | ⚠️ Requires permission* |
network.carrier.mcc | Mobile country code | "310" | ⚠️ Requires permission* |
network.carrier.mnc | Mobile network code | "260" | ⚠️ Requires permission* |
network.carrier.icc | ISO country code | "US" | ⚠️ Requires permission* |
screen.name | Current screen/activity name | "MainActivity" | ⚠️ If available |
session.id | Session identifier | "f40364c92b85ec0c19c35a65be42b97f" | ✅ Yes |
* Requires READ_PHONE_STATE or READ_BASIC_PHONE_STATE (API 33+) permission
Note: All network change events include global attributes (service, device, OS, session, network carrier, etc.) in the
resourcesobject. See Global Attributes for complete list.
Sample Payload: Network Available
{
"body": "Network available",
"date": "2025-11-27T08:46:00.000000Z",
"id": "0iiPdg5oW57kWey8dHienFjlP9S",
"timestamp": "2025-11-27T08:46:00.000000Z",
"attributes": {
"pulse.type": "network.change",
"network.status": "available",
"network.connection.type": "wifi",
"network.connection.subtype": "wifi",
"network.carrier.name": "Verizon",
"network.carrier.mcc": "310",
"network.carrier.mnc": "260",
"network.carrier.icc": "us",
"screen.name": "MainActivity",
"session.id": "f40364c92b85ec0c19c35a65be42b97f"
},
"resources": {
"android.os.api_level": "36",
"app.build_id": "1",
"app.build_name": "1.0_1",
"device.manufacturer": "Google",
"device.model.identifier": "sdk_gphone64_arm64",
"device.model.name": "sdk_gphone64_arm64",
"os.description": "BE2A.250530.026.D1",
"os.name": "Android",
"os.type": "linux",
"os.version": "16",
"rum.sdk.version": "0.16.0-alpha-SNAPSHOT",
"service.name": "PulseReactNativeOtelExample",
"service.version": "1.0_1",
"telemetry.sdk.language": "java",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.54.1"
}
}
Sample Payload: Network Lost
{
"body": "Network lost",
"date": "2025-11-27T08:47:00.000000Z",
"id": "0iiPdg5oW57kWey8dHienFjlP9S",
"timestamp": "2025-11-27T08:47:00.000000Z",
"attributes": {
"pulse.type": "network.change",
"network.status": "lost",
"network.connection.type": "unavailable",
"screen.name": "MainActivity",
"session.id": "f40364c92b85ec0c19c35a65be42b97f"
},
"resources": {
"android.os.api_level": "36",
"app.build_id": "1",
"app.build_name": "1.0_1",
"device.manufacturer": "Google",
"device.model.identifier": "sdk_gphone64_arm64",
"device.model.name": "sdk_gphone64_arm64",
"os.description": "BE2A.250530.026.D1",
"os.name": "Android",
"os.type": "linux",
"os.version": "16",
"rum.sdk.version": "0.16.0-alpha-SNAPSHOT",
"service.name": "PulseReactNativeOtelExample",
"service.version": "1.0_1",
"telemetry.sdk.language": "java",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.54.1"
}
}
Permissions
To get detailed network information (subtype, carrier name, etc.), add the following permission to your AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
For API 33+:
<uses-permission android:name="android.permission.READ_BASIC_PHONE_STATE" />
- Only basic connection type is available
- Carrier name may be limited to SIM-provided name
With permissions:
- Full connection subtype (LTE, 5G, etc.)
- Standardized carrier name (e.g., "T-Mobile-US")
- Mobile country code (MCC) and network code (MNC)
- ISO country code (ICC)
Use Cases
- Monitor connectivity issues: Track when users lose network connectivity
- Network quality analysis: Correlate network changes with app performance
- Carrier-specific issues: Identify problems specific to certain carriers