Starting with Batch 1.12, you can now opt-out from the SDK.
If you plan to send personal user data and have to comply with EU's GDPR, any other data privacy law or simply want to give your users more control regarding their privacy, these methods will help you plug your consent screen to Batch.
There are two SDK operation modes:
Important: Disabling the SDK will also disable In-App messages, data collection and may not disable notifications if you are using a custom receiver. In case you simply want to implement a custom opt-out, we recommend you use Batch's native methods (know more here).
In order to opt-out from SDK, simply call:
Opting out will:
Batch.onServiceCreate(Context, boolean)from doing anything at all
Batch.User.trackLocation(Location)and any related methods
Even if you opt-in afterwards, data generated (such as user data or tracked events) while opted out WILL be lost.
Important note: Calling this method will stop Batch, effectively simulating calls to
You can also wipe the local SDK data:
Remote data will not be wiped. To do so, please make a separate deletion request.
Note: Opting out is not possible while the SDK hasn't started. Make sure you've called
In order to disable the SDK by default, you need to add a meta-data entry to your AndroidManifest's
<meta-data android:name="batch_opted_out_by_default" android:value="false" />
Once you've opted-out (either programatically, or by default), you can re-enable the SDK by calling the following:
Note: Even if you've already done so before opting-out, you are required to call
Batch.onStart()or the SDK won't work until the next start.