SDK opt-out (e.g. GDPR)

Starting with Batch 2.0, 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.

Important: We recommend against disabling the SDK if you simply want to add a custom notification opt-out to the settings of your app. You should instead:

  • iOS: Direct users to iOS' settings.
  • Android: Use Batch's native methods to disable notifications (know more here).


In order to opt-out from SDK, simply call:


Opting out will:

  • Prevent batch.start()
  • Disable any network capability from the SDK
  • Disable all In-App campaigns
  • Make the Inbox module return an error immediatly when used
  • Make the SDK reject any batch.user.editor() modifications, even when saved
  • Make the SDK reject calls to batch.user.trackEvent(), batch.user.trackTransaction(), batch.user.trackLocation() 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.

You can also wipe the local SDK data:


This will wipe the data locally and request a remote data removal for the matching advertising ID/Custom User ID. Batch will blacklist the advertising and the Custom User ID for one month following the data removal. Batch will also discard the data sent from the Custom Data API for that specific Custom User ID. The Inbox feature will no longer work if you were relying on the Custom User ID.

Note: Opting out is not possible while the SDK hasn't started. Make sure you've called batch.start() beforehand.


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.start() or the SDK won't work until the next start.