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

# Data Collection

> Comprehensive overview of performance metrics, event attributes, and device information automatically collected by Flashduty Android RUM SDK

<Info>
  Flashduty Android RUM SDK automatically collects multiple metrics and attributes for all RUM events by default. You can also add custom attributes via API to extend the default dataset.
</Info>

## Privacy and Permissions

Flashduty Android RUM SDK collects only the runtime information needed for real user monitoring, error diagnosis, performance analysis, and network request analysis. The SDK itself declares the following Android permissions:

| Permission                                | Purpose                                                              |
| ----------------------------------------- | -------------------------------------------------------------------- |
| `android.permission.INTERNET`             | Upload RUM, Trace, Log, and other observability data                 |
| `android.permission.ACCESS_NETWORK_STATE` | Read network connectivity state and attach network context to events |

<Warning>
  The SDK itself does not declare or require sensitive permissions such as `READ_PHONE_STATE`, `ACCESS_FINE_LOCATION`, or `ACCESS_COARSE_LOCATION`.
</Warning>

### Device Identifiers Not Collected

The Android RUM SDK does not read or report the following unique device identifiers:

| Identifier                                        | Collected | Notes                                                              |
| ------------------------------------------------- | --------- | ------------------------------------------------------------------ |
| Android ID / SSAID (`Settings.Secure.ANDROID_ID`) | No        | The SDK does not read Android ID                                   |
| IMEI / MEID / device ID                           | No        | The SDK does not call `getDeviceId()`, `getImei()`, or `getMeid()` |
| Device serial number                              | No        | The SDK does not read `Build.SERIAL` or `Build.getSerial()`        |
| OAID / advertising ID                             | No        | The SDK does not read OAID, GAID, or other advertising identifiers |
| Phone number, contacts, SMS, photos               | No        | The SDK does not access these system data sources                  |

<Note>
  RUM may generate an anonymous user ID by default to correlate the same anonymous user across sessions. This ID is a randomly generated UUID stored in the app's local data directory. It is not derived from Android ID, IMEI, OAID, or advertising ID. You can disable anonymous user tracking in the RUM configuration.
</Note>

### System Context Collected

The SDK automatically attaches the following system context to help diagnose performance, crash, and network issues:

| Data Category       | Examples                                                                                    | Purpose                                                                                                                                                   |
| ------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| App information     | Package name, version name, build version, environment, service name                        | Distinguish apps, versions, and environments                                                                                                              |
| Device information  | Device brand, model, type, CPU architecture, number of displays                             | Analyze device compatibility and performance differences                                                                                                  |
| OS information      | Android version, major version, build number, locale, time zone                             | Diagnose OS-version or region-specific issues                                                                                                             |
| Network information | Network type, cellular technology, carrier name, uplink/downlink bandwidth, signal strength | Analyze how network quality affects user experience                                                                                                       |
| RUM events          | View, Action, Resource, Error, Long Task, app startup timing                                | Reconstruct user journeys and diagnose errors or performance bottlenecks                                                                                  |
| User information    | `usr.id`, `usr.name`, `usr.email`, `usr.anonymous_id`                                       | Attached only when your app explicitly sets user data through the API; other user attributes are not supported. If needed, configure them under `context` |

<Info>
  The geo-location fields documented below are inferred by the Flashduty backend from the client request IP address. They are not collected from Android system location APIs. The SDK does not call GPS, cell-tower location, or fused location APIs, and it does not require location permissions.
</Info>

## App Startup Metrics

Flashcat automatically collects the following app startup performance metrics:

| Metric                        | Description                | Measurement Range                                               |
| ----------------------------- | -------------------------- | --------------------------------------------------------------- |
| **cold\_start\_duration**     | Cold start duration        | From app process creation to first Activity render complete     |
| **warm\_start\_duration**     | Warm start duration        | App process exists, from Activity start to render complete      |
| **hot\_start\_duration**      | Hot start duration         | App and Activity both in memory, from resume to render complete |
| **activity\_start\_duration** | Activity start duration    | From `onCreate` to first frame draw complete                    |
| **is\_pre\_warmed**           | Pre-warmed start indicator | Boolean, indicates if app started via pre-warming (Android 11+) |

<Tip>
  **Startup Type Descriptions:**

  * **Cold Start** - App first launch or launch after process terminated, needs to load all resources and initialize app state
  * **Warm Start** - App process in memory, but Activity needs to be recreated
  * **Hot Start** - App and Activity both in memory, only needs to bring Activity to foreground
</Tip>

## Views Monitoring

A View represents a unique screen the user sees in the app. Each View creates a new RUM event when it starts, and updates that event throughout the View's lifecycle.

<Note>
  Views collect information about all resources, actions, errors, and long tasks that occur during their lifecycle.
</Note>

### Auto Tracking Strategies

In Android, Activities and Fragments are considered Views. The SDK provides the following auto tracking strategies:

| Strategy                           | Description                         | Use Case                          |
| ---------------------------------- | ----------------------------------- | --------------------------------- |
| **ActivityViewTrackingStrategy**   | Track based on Activity lifecycle   | Traditional Activity architecture |
| **FragmentViewTrackingStrategy**   | Track based on Fragment lifecycle   | Fragment-centric apps             |
| **MixedViewTrackingStrategy**      | Track both Activities and Fragments | Mixed architecture apps           |
| **NavigationViewTrackingStrategy** | For Jetpack Navigation component    | Apps using Navigation             |

<Tip>
  You can also customize View tracking by manually calling `RumMonitor.startView()` and `RumMonitor.stopView()`.
</Tip>

## Default Attributes

RUM SDK automatically attaches default attributes to all events, helping you understand user devices, network status, and app context.

<AccordionGroup>
  <Accordion title="Core Attributes">
    | Attribute             | Type   | Description                                                              |
    | --------------------- | ------ | ------------------------------------------------------------------------ |
    | `application.id`      | string | Flashcat application ID                                                  |
    | `application.name`    | string | App package name (e.g., `com.example.app`)                               |
    | `application.version` | string | App version name                                                         |
    | `application.build`   | string | App build version number                                                 |
    | `session.id`          | string | Unique session ID for grouping events in user journey                    |
    | `session.type`        | string | Session type: `user`                                                     |
    | `view.id`             | string | Unique ID generated for each View                                        |
    | `view.url`            | string | Normalized View URL (Activity or Fragment class name)                    |
    | `view.name`           | string | Customizable View name                                                   |
    | `env`                 | string | App environment name (e.g., `prod`, `dev`)                               |
    | `service`             | string | Service name, used to distinguish different app modules or microservices |
    | `version`             | string | App version                                                              |
    | `sdk_version`         | string | Flashcat SDK version                                                     |
    | `date`                | number | Event timestamp (epoch milliseconds)                                     |
    | `type`                | string | Event type (e.g., `view`, `resource`, `action`, `error`, `long_task`)    |
  </Accordion>

  <Accordion title="Device Attributes">
    The following device-related attributes are automatically collected in all RUM events:

    | Attribute               | Type   | Description                                         |
    | ----------------------- | ------ | --------------------------------------------------- |
    | `device.type`           | string | Device type, e.g., `mobile`, `tablet`, `tv`         |
    | `device.name`           | string | Device commercial name (e.g., `Samsung Galaxy S21`) |
    | `device.model`          | string | Device model (e.g., `SM-G991B`)                     |
    | `device.brand`          | string | Device brand (e.g., `Samsung`)                      |
    | `device.architecture`   | string | Device architecture (e.g., `arm64-v8a`)             |
    | `device.marketing_name` | string | Device marketing name                               |
  </Accordion>

  <Accordion title="Connectivity Attributes">
    The following network-related attributes are automatically collected in all RUM events:

    | Attribute                            | Type   | Description                                                                 |
    | ------------------------------------ | ------ | --------------------------------------------------------------------------- |
    | `connectivity.status`                | string | Device network reachability status (`connected`, `not_connected`, `maybe`)  |
    | `connectivity.interfaces`            | array  | List of available network interfaces (e.g., `wifi`, `cellular`, `ethernet`) |
    | `connectivity.cellular.technology`   | string | Cellular network technology type (e.g., `LTE`, `5G`)                        |
    | `connectivity.cellular.carrier_name` | string | Carrier name                                                                |
  </Accordion>

  <Accordion title="Operating System Attributes">
    The following OS-related attributes are automatically collected in all RUM events:

    | Attribute          | Type   | Description                                   |
    | ------------------ | ------ | --------------------------------------------- |
    | `os.name`          | string | Operating system name (e.g., `Android`)       |
    | `os.version`       | string | Operating system version (e.g., `13`)         |
    | `os.version_major` | string | Operating system major version (e.g., `13`)   |
    | `os.build`         | string | System build number (e.g., `TQ2A.230505.002`) |
  </Accordion>

  <Accordion title="Geo-location Attributes">
    Flashcat RUM can infer geographic location information from user's IP address:

    | Attribute         | Type   | Description      |
    | ----------------- | ------ | ---------------- |
    | `geo.country`     | string | Country name     |
    | `geo.country_iso` | string | Country ISO code |
    | `geo.city`        | string | City name        |

    <Note>
      Geo-location information is inferred by Flashcat backend based on client IP address. Precise GPS location is not collected on the Android client, and location permissions are not required.
    </Note>
  </Accordion>

  <Accordion title="Global User Attributes">
    You can set user information via the `setUser()` API, which will be attached to all RUM events:

    | Attribute          | Type   | Description               |
    | ------------------ | ------ | ------------------------- |
    | `usr.id`           | string | User's unique identifier  |
    | `usr.name`         | string | User's friendly name      |
    | `usr.email`        | string | User's email address      |
    | `usr.anonymous_id` | string | Anonymous user identifier |

    <Note>
      Only the standard user fields above are supported. Other user attributes are not supported. If needed, configure them under `context`.
    </Note>
  </Accordion>
</AccordionGroup>

## Event-Specific Attributes

In addition to default attributes, different types of RUM events collect specific metrics and attributes.

<AccordionGroup>
  <Accordion title="Session Attributes">
    | Attribute            | Type   | Description                                       |
    | -------------------- | ------ | ------------------------------------------------- |
    | `session.id`         | string | Unique session ID                                 |
    | `session.type`       | string | Session type: `user`                              |
    | `session.has_replay` | bool   | Whether session includes session replay recording |
    | `session.is_active`  | bool   | Whether session is active                         |
  </Accordion>

  <Accordion title="View Attributes">
    View events include the following specific attributes and performance metrics:

    | Attribute                     | Type       | Description                                                               |
    | ----------------------------- | ---------- | ------------------------------------------------------------------------- |
    | `view.id`                     | string     | Unique ID for each View                                                   |
    | `view.name`                   | string     | Custom View name                                                          |
    | `view.url`                    | string     | View URL (Activity or Fragment class name)                                |
    | `view.time_spent`             | number(ns) | Time user spent on this View                                              |
    | `view.loading_time`           | number(ns) | Time for View to finish loading                                           |
    | `view.loading_type`           | string     | View loading type: `initial_load`, `activity_display`, `fragment_display` |
    | `view.first_contentful_paint` | number(ns) | First Contentful Paint time (API 29+ only)                                |
    | `view.action.count`           | number     | Number of all actions collected in View                                   |
    | `view.resource.count`         | number     | Number of all resources collected in View                                 |
    | `view.error.count`            | number     | Number of all errors collected in View                                    |
    | `view.long_task.count`        | number     | Number of all long tasks collected in View                                |
    | `view.crash.count`            | number     | Number of all crashes collected in View                                   |
    | `view.is_active`              | bool       | Whether View is still active                                              |
  </Accordion>

  <Accordion title="Resource Attributes">
    Resource events represent network requests in the app. Collected attributes include:

    | Attribute                      | Type       | Description                                                                          |
    | ------------------------------ | ---------- | ------------------------------------------------------------------------------------ |
    | `resource.id`                  | string     | Resource unique identifier                                                           |
    | `resource.type`                | string     | Resource type (e.g., `xhr`, `fetch`, `image`, `css`, `js`, `font`, `media`, `other`) |
    | `resource.url`                 | string     | Resource URL                                                                         |
    | `resource.method`              | string     | HTTP method (e.g., `GET`, `POST`)                                                    |
    | `resource.status_code`         | number     | HTTP response status code                                                            |
    | `resource.duration`            | number(ns) | Total time spent loading resource                                                    |
    | `resource.size`                | number     | Resource size (bytes)                                                                |
    | `resource.dns.duration`        | number(ns) | DNS resolution time (`domainLookupEnd - domainLookupStart`)                          |
    | `resource.connect.duration`    | number(ns) | Connection establishment time (`connectEnd - connectStart`)                          |
    | `resource.ssl.duration`        | number(ns) | TLS handshake time (`connectEnd - secureConnectionStart`), HTTPS only                |
    | `resource.first_byte.duration` | number(ns) | Time waiting for first byte response (`responseStart - requestStart`)                |
    | `resource.download.duration`   | number(ns) | Response download time (`responseEnd - responseStart`)                               |
    | `resource.redirect.duration`   | number(ns) | Time spent on subsequent HTTP redirects (`redirectEnd - redirectStart`)              |
    | `resource.provider.name`       | string     | Resource provider name, defaults to `unknown`                                        |
    | `resource.provider.domain`     | string     | Resource provider domain                                                             |
    | `resource.provider.type`       | string     | Resource provider type (e.g., `first-party`, `cdn`, `ad`, `analytics`)               |
  </Accordion>

  <Accordion title="Error Attributes">
    Error events collect exception and crash information. Error messages and stack traces are automatically included:

    | Attribute        | Type   | Description                                                                                       |
    | ---------------- | ------ | ------------------------------------------------------------------------------------------------- |
    | `error.source`   | string | Error source (e.g., `webview`, `logger`, `network`, `source`, `console`)                          |
    | `error.type`     | string | Error type or error code                                                                          |
    | `error.message`  | string | Concise, human-readable one-line error message                                                    |
    | `error.stack`    | string | Stack trace or supplementary error information                                                    |
    | `error.issue_id` | string | Error issue unique identifier                                                                     |
    | `error.category` | string | Error high-level classification, possible values: `ANR` (Application Not Responding), `Exception` |
    | `error.file`     | string | Filename where error occurred (for error tracking issues)                                         |
    | `error.line`     | number | Line number where error occurred                                                                  |
    | `error.is_crash` | bool   | Indicates if this error caused app crash                                                          |

    **Network Errors:**

    Network errors contain information about failed HTTP requests and collect the following attributes:

    | Attribute                        | Type   | Description                                                            |
    | -------------------------------- | ------ | ---------------------------------------------------------------------- |
    | `error.resource.status_code`     | number | HTTP response status code                                              |
    | `error.resource.method`          | string | HTTP method (e.g., `POST`, `GET`)                                      |
    | `error.resource.url`             | string | Resource URL                                                           |
    | `error.resource.provider.name`   | string | Resource provider name, defaults to `unknown`                          |
    | `error.resource.provider.domain` | string | Resource provider domain                                               |
    | `error.resource.provider.type`   | string | Resource provider type (e.g., `first-party`, `cdn`, `ad`, `analytics`) |
  </Accordion>

  <Accordion title="Action Attributes">
    Actions represent user interactions with the app (e.g., clicks, swipes, scrolls).

    **Timing Attributes:**

    | Attribute                | Type       | Description                                        |
    | ------------------------ | ---------- | -------------------------------------------------- |
    | `action.loading_time`    | number(ns) | Action loading time                                |
    | `action.long_task.count` | number     | Number of all long tasks collected for this action |
    | `action.resource.count`  | number     | Number of all resources collected for this action  |
    | `action.error.count`     | number     | Number of all errors collected for this action     |

    **Basic Attributes:**

    | Attribute            | Type   | Description                                                            |
    | -------------------- | ------ | ---------------------------------------------------------------------- |
    | `action.id`          | string | User action UUID                                                       |
    | `action.type`        | string | User action type (e.g., `tap`, `scroll`, `swipe`, `application_start`) |
    | `action.name`        | string | User action name                                                       |
    | `action.target.name` | string | Element user interacted with, only for auto-collected actions          |
  </Accordion>
</AccordionGroup>

## Data Storage and Security

### Local Storage Mechanism

Before data is uploaded to Flashcat, it is stored in plaintext in the app's cache directory.

**Storage Location:**

```
/data/data/<package_name>/cache/com.flashcat.rum/
```

<Check>
  **Security Protection:**

  * Cache folder is protected by Android app sandbox
  * On most devices, other apps cannot read this data
</Check>

<Warning>
  **Security Notes:**

  * If mobile device is rooted or Linux kernel is tampered with, stored data may become readable
  * Sensitive data should not be included in RUM events, or should be obfuscated or filtered via `EventMapper` before sending
</Warning>

## Data Upload Mechanism

Flashcat RUM Android SDK uses batch processing to upload events, ensuring data transmission while minimizing impact on user experience.

### Batch Processing Flow

<Steps>
  <Step title="Event Collection">
    SDK appends uncompressed events to batch files using TLV encoding format (Tag-Length-Value).
  </Step>

  <Step title="Batch Optimization">
    When batch closes:

    * Read batch file and extract events
    * Deduplicate RUM events (remove redundant View events)
    * Build payload specific to each trace
  </Step>

  <Step title="Compressed Upload">
    Use gzip compression to reduce network traffic and upload time.
  </Step>
</Steps>

### Upload Triggers

Batches are uploaded when any of the following occurs:

| Trigger          | Description                                   |
| ---------------- | --------------------------------------------- |
| **File Size**    | Batch file size reaches threshold (e.g., 4MB) |
| **Event Count**  | Number of events in batch reaches threshold   |
| **App State**    | App switches to background                    |
| **Timed Upload** | Periodic upload (e.g., every 5 seconds)       |

### Upload Strategy

<Check>
  **Smart Upload Mechanism:**

  * **Network Optimization** - Prefer WiFi upload, mobile network also supported
  * **Battery Management** - Ensures not to excessively drain device battery
  * **Failure Retry** - Batches are retained locally on upload failure until successfully sent
  * **Data Compression** - Uses gzip compression to reduce network traffic
</Check>

## Direct Boot Mode Support

If your app supports Direct Boot mode (launching before device unlock), note:

<Warning>
  Data captured before device unlock will **not be recorded** because credential-encrypted storage is not yet available.
</Warning>

<Note>
  Flashcat SDK will start collecting data after device unlock. If you need to collect data in Direct Boot mode, ensure you use device-encrypted storage instead of credential-encrypted storage.
</Note>

## Related Documentation

<CardGroup cols={3}>
  <Card title="SDK Integration" icon="rocket" href="/en/rum/sdk/android/sdk-integration">
    Learn how to integrate the Android SDK
  </Card>

  <Card title="Advanced Configuration" icon="sliders" href="/en/rum/sdk/android/advanced-config">
    Configure custom attributes, sampling, and event filtering
  </Card>

  <Card title="Insights" icon="chart-line" href="/en/rum/analytics/native">
    View and analyze collected RUM data
  </Card>
</CardGroup>
