# Permissions Setup

The Agent App requires several Android permissions to collect device data and deliver the features included in your package. This section explains **the required permissions, their purpose, and how users should grant them correctly**.

| <div><figure><img src="https://4187053630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjkSePRf5HsNK8f87ZonZ%2Fuploads%2Fgit-blob-46f59f2cc83c31367be471211d56b7a4b25340d1%2Fimage%20(62).png?alt=media" alt=""><figcaption></figcaption></figure></div> | <div><figure><img src="https://4187053630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjkSePRf5HsNK8f87ZonZ%2Fuploads%2Fgit-blob-211b74b4597740481d8f414e10833dcdc7053e75%2Fimage%20(63).png?alt=media" alt=""><figcaption></figcaption></figure></div> |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

***

### 1. Location Permissions

**Purpose:** Collect GPS coordinates to support features such as live tracking, location history, and geofencing.

* `ACCESS_FINE_LOCATION`\
  Grants precise GPS location. Required for accurate tracking.
* `ACCESS_COARSE_LOCATION`\
  Grants approximate location based on Wi-Fi and mobile networks.
* `ACCESS_BACKGROUND_LOCATION` *(Android 10+)*\
  Allows the app to collect location data even when it is running in the background.

  > **Note:** Starting with Android 10, background location must be requested separately. The user will see a system dialog asking to grant “Allow all the time” access.

***

### 2. Phone & SMS Permissions

**Purpose:** Collect call logs and SMS records for reporting in the Admin Panel.

* `READ_CALL_LOG`\
  Allows reading of the device’s call history (incoming, outgoing, missed calls).
* `READ_SMS`\
  Allows reading of SMS messages stored on the device.
* `RECEIVE_SMS`\
  Allows the app to detect new SMS messages as they arrive.
* `SEND_SMS` *(optional)*\
  Only required if the app supports sending SMS remotely.

***

### 3. Contacts Permissions

**Purpose:** Retrieve the user’s contact list for synchronization with the Admin Panel.

* `READ_CONTACTS`\
  Grants read access to the contact database.
* `WRITE_CONTACTS` *(optional)*\
  Needed only if the app modifies or adds new contacts.

***

### 4. Storage & Media Permissions

**Purpose:** Collect photos, videos, and files stored on the device.

* `READ_EXTERNAL_STORAGE` *(Android 9 and below)*
* `WRITE_EXTERNAL_STORAGE` *(Android 9 and below)*

> Starting from Android 10, Google introduced Scoped Storage. For Android 13 and above, the following granular permissions are required:

* `READ_MEDIA_IMAGES`
* `READ_MEDIA_VIDEO`
* `READ_MEDIA_AUDIO`

If the app requires unrestricted access to all files, the special `MANAGE_EXTERNAL_STORAGE` Permission may be requested (only if absolutely necessary).

***

### 5. Microphone Permissions

**Purpose:** Support ambient audio recording or live audio streaming.

* `RECORD_AUDIO`\
  Grants access to the microphone.
* `FOREGROUND_SERVICE_MICROPHONE` *(Android 10+)*\
  Required when recording audio from a foreground service.

***

### 6. Camera Permissions

**Purpose:** Capture snapshots, videos, or scan QR codes during pairing.

* `CAMERA`\
  Grants access to the device’s camera hardware.

***

### 7. Device Information & System Permissions

**Purpose:** Collect hardware identifiers, installed applications, and system status.

* `READ_PHONE_STATE`\
  Allows access to device identifiers (e.g., IMEI, SIM status, network info).
* `QUERY_ALL_PACKAGES` *(Android 11+)*\
  Allows the app to see the full list of installed apps. This is required if application monitoring is enabled.
* `PACKAGE_USAGE_STATS`\
  Allows access to usage statistics (e.g., which apps were opened and for how long).
* `BIND_ACCESSIBILITY_SERVICE` *(optional, advanced)*\
  Grants the app Accessibility Service rights if certain automation features are enabled.
* `SYSTEM_ALERT_WINDOW` *(optional)*\
  Allows the app to display overlay windows. Used only for specific features.

***

### 8. Notification Access

**Purpose:** Capture notifications that appear on the device (optional feature).

* `BIND_NOTIFICATION_LISTENER_SERVICE`\
  Allows the app to listen to all system notifications.

***

### 9. How Users Should Grant Permissions

1. **During Installation**
   * The app will request essential runtime permissions (Location, SMS, Contacts, etc.).
   * The user must tap **Allow** to enable each permission.
2. **After Installation**
   * For background permissions (such as Background Location), the user must open **System Settings → Apps → \[Agent App] → Permissions** and manually switch to **“Allow all the time”**.
3. **Special Cases**
   * Notification Access, Accessibility Service, or Device Admin rights (if required) must be granted via a separate system dialog. The user will be guided step-by-step inside the app.

***

### 10. Important Notes

* Without granting the correct permissions, the Agent App will not be able to collect or synchronize data.
* On Android 11 and above, additional privacy restrictions apply. Users must follow the prompts carefully.
* Some device manufacturers (Samsung, Xiaomi, Oppo, etc.) may have additional permission management layers. Users should disable **battery optimization** for the Agent App to ensure continuous data collection.
