Consent and user data
Run nothing until your user agrees, let them opt out, erase what Bubbl recorded about them, or pause Bubbl on the device.
Bubbl gives your app these controls over what it does for a user. Your app shows the choices; Bubbl remembers the answer on the device, across launches.
| Call | What it does | Server told? |
|---|---|---|
requireConsent option | Nothing runs (no network, location or notifications) until setConsent(true). | No: nothing is sent yet. |
setConsent(true) | Starts everything. Also gives consent again after an opt-out. | Yes |
optOut() or setConsent(false) | Stops Bubbl for this user: geofences stop, queued events are dropped, and nothing more is sent, shown or tracked. | Yes |
deleteMyData() | Opts out, then erases the device and everything Bubbl recorded about it, on the server and on the phone. | Yes |
setLocationEnabled(false) | Stops Bubbl's use of location (geofences). Everything else carries on. | No |
stop() | Stops Bubbl on this device until start is called again. Nothing is dropped. | No |
Asking for consent first#
If your users must agree before Bubbl does anything, start it with requireConsent. Keep calling start at every launch as usual; Bubbl waits until you call setConsent(true), and remembers it from then on.
Bubbl.start(this, "pk_live_…", BubblOptions(baseUrl = "https://api.bubbl.tech", requireConsent = true))
// Later, when the user agrees:
Bubbl.setConsent(true)Bubbl.start(apiKey: "pk_live_…", options: BubblOptions(baseUrl: "https://api.bubbl.tech", requireConsent: true))
// Later, when the user agrees:
Bubbl.setConsent(true)await Bubbl.start(
apiKey: 'pk_live_…',
options: const BubblOptions(baseUrl: 'https://api.bubbl.tech', requireConsent: true),
);
// Later, when the user agrees:
await Bubbl.setConsent(true);Bubbl.start('pk_live_…', { baseUrl: 'https://api.bubbl.tech', requireConsent: true });
// Later, when the user agrees:
Bubbl.setConsent(true);Until then, active is false in diagnostics, with consentRequired true and consent null. A dashboard test push to the phone is dropped while it isn't active.
Opting out#
optOut(), or setConsent(false), stops Bubbl for the user and tells the server. It stays stopped at later launches, whether or not you started with requireConsent, until the user gives consent again with setConsent(true). In diagnostics, consent is false and active false.
Erasing a user's data#
deleteMyData() erases the device and everything Bubbl recorded about it, on the server and on the phone. It keeps trying until the server confirms, even across launches, and Bubbl stays off afterwards. If the user later gives consent again with setConsent(true), Bubbl starts afresh as a new device.
- An install that never registered has nothing on the server to erase.
- If the device's credential was revoked, Bubbl registers again under the same install ID in order to erase it.
Turning location off#
setLocationEnabled(false) turns off geofences and Bubbl's use of location, and pushes, notifications and events carry on. Use it for an in-app "location-based offers" switch. locationEnabled in diagnostics shows the setting. See Location and geofences.
Stopping Bubbl on this device#
stop() stops everything on the device (geofences, background work, notifications) without telling the server or dropping anything. It lasts until the next start, which for most apps is the next launch. Use optOut() for a user's choice, and stop() for your app's own reasons.
Where each call works#
All of these are safe from any thread. Called before start they do nothing and log a warning. In Flutter they return a Future; in React Native they return nothing.
Related#
- Permissions and privacy: the privacy view and system prompts.
- Bubbl reference