# Privacy & consent

> Gate the Grovs Android SDK on user consent, and see what it collects.

Source: https://docs.grovs.io/docs/sdk/android/privacy

## Gating collection on consent

A disabled SDK collects nothing. To start a launch disabled, pass your stored consent to `configure`. Calling `setSDK(false)` afterwards is too late: `configure` starts the first round of collection.

```kotlin
val hasConsent = ConsentStore.hasConsent()

Grovs.configure(
    this,
    "your-api-key",
    useTestEnvironment = false,
    baseURL = null,
    autoTrackScreenViews = true,
    clipboardDomains = null,
    enabled = hasConsent
)
```

Toggle it as consent changes:

```kotlin
fun userDidChangeConsent(granted: Boolean) {
    ConsentStore.save(granted)
    Grovs.setSDK(granted)
}
```

The SDK **doesn't persist** the flag. Pass your stored value to `configure` on every launch. Shorter `configure` overloads reset it to `true`, so use the full overload and call `setSDK` only after `configure`.

With `enabled = false`, `configure` starts no requests, reads no clipboard or device identifiers and records no events. The install and first open are recorded once the SDK is enabled and authenticates.

### While the SDK is disabled

- Nothing leaves the device: no authentication, device lookup, events, screen views or purchases.
- Automatic screen tracking stops. Time spent disabled is excluded from engagement.
- Backend features are unavailable. Link generation and link details fail with their usual `GrovsException`.
- In-app messages don't sync or show, and a message on screen closes.
- Tapped pushes deliver nothing and report no opens. A tap is handled if you enable the SDK before the app goes to the background. Disabling drops unreported push opens.
- Outstanding operations and their retries are cancelled. Requests already transmitted may still reach the server.
- Changes to `identifier`, `attributes`, `pushToken` and screen aliases are held as the latest values.
- Queued events keep their identity and stay on the device, within the usual retention limits.

Re-enabling authenticates if needed and sends everything held or queued.

> **Warning:** Enabling **doesn't** replay a launch deep link or a link request cancelled while disabled. To resolve a link that opened the app while disabled, forward a later `Grovs.onStart(activity)` or `Grovs.onNewIntent(intent, activity)`.

## What the SDK collects

| Data                                                                                                                                 | When                                                                                                                                                                                                                                                 | Why                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| App version and build, package name, device model, user agent, screen size, time zone, preferred language, WebGL vendor and renderer | When the SDK authenticates and looks up the device                                                                                                                                                                                                   | Matching installs and opens to link clicks; analytics                                                                                                                           |
| The Android ID (`Settings.Secure.ANDROID_ID`) and the Google Play install referrer                                                   | Same                                                                                                                                                                                                                                                 | Recognizing the device across launches; install attribution. The backend-issued device identifier is held in memory only                                                        |
| User identifier, user attributes, push token                                                                                         | Only if you set them                                                                                                                                                                                                                                 | Showing users in the dashboard; delivering push campaigns and in-app messages                                                                                                   |
| Push campaign opens: campaign ID and session                                                                                         | When the user taps a Grovs push                                                                                                                                                                                                                      | Campaign reports                                                                                                                                                                |
| In-app message views, clicks, dismissals, answers and comments                                                                       | When a message shows and the user acts on it                                                                                                                                                                                                         | Campaign reports; frequency caps                                                                                                                                                |
| Installs, opens, time spent, reactivations                                                                                           | Automatically                                                                                                                                                                                                                                        | Attribution and analytics                                                                                                                                                       |
| Custom events and screen views                                                                                                       | When you call `track` / `trackScreenView` / `trackNavigation`, and through automatic screen tracking                                                                                                                                                 | Analytics                                                                                                                                                                       |
| Purchases                                                                                                                            | When you call `logInAppPurchase` or `logCustomPurchase`                                                                                                                                                                                              | Revenue analytics                                                                                                                                                               |
| Clipboard contents                                                                                                                   | Read only on the first launch after install, when fingerprint matching found nothing, your project has recent copy-to-clipboard clicks and the clipboard holds a web URL. Sent only if it's a link on a Grovs host or one of your `clipboardDomains` | Deterministic install attribution. See [clipboard-assisted deferred deep linking](https://docs.grovs.io/docs/sdk/android/deep-linking#clipboard-assisted-deferred-deep-linking) |

The SDK doesn't read the advertising ID.

## Google Play data safety

Your Google Play Data safety form must cover what the SDK collects for you. Typically:

- **Device or other IDs**
- **App activity → App interactions**
- **Personal info → User IDs**, if you set `identifier`
- **Financial info → Purchase history**, if you log purchases
- **App activity → Other user-generated content**, if your in-app questions ask for a comment

Anything in `attributes` or event properties (an email or name, say) is data you collect too and needs its own declaration.

## Logs

SDK logs go through `android.util.Log` with tag `Logger`, and every message starts with `🔗GROVS`. Filter Logcat by message text, not tag. The default level is `ERROR`. Pass `LogLevel.INFO` to [`setDebug`](https://docs.grovs.io/docs/sdk/android/api-reference#setdebug) while integrating.
