How to test the integration on Android?

Follow this guide to make sure Batch's SDK is integrated correctly before releasing your app to the PlayStore.

There are several points you should check to make sure you will be able to use Batch at its full potential:

1. SDK version & production environment

SDK version

First and foremost, check our Android changelog to ensure you are using the latest version of the Batch SDK.

Use the right SDK API key

Ensure you have selected the SDK API key corresponding to the right environment (e.g., staging, dev, prod, etc.).

Make sure you switch to the SDK API key of your production environment before releasing a new version of your app to the store.

Find the right SDK API key from Batch's dashboard > Settings > General and change it in your code.

2. Small icon support

What is the small icon?

The small icon is the icon Android displays in your notification.

smal icon example

How to test the integration?

Send a notification to your device to see if the small icon is displayed correctly. If you used a colored small icon, Android will display it as a white square/circle, except on Samsung devices, where the icon will be displayed correctly:

small icon issue

How to fix the issue?

You will need to set a valid small icon. It should be opaque white, using only the alpha channel and 24x24dp (Setting up small icon). You can also set an accent color for your small icon (Setting up custom color).

3. In-App messages display

What are In-App messages?

In-App messages are messages displayed inside your app. You can trigger an In-App message when users open your app, perform a specific action, or as a landing page after opening a push notification.

How to test the integration?

Go to Settings > Themes. Pick a theme or create a new one. Select your device token, then click the "Preview" button.

The In-App message should be displayed correctly, ideally after your splash screen:

Example of an in app creation

How to fix the issue?

Batch's SDK tries to display the In-App message as soon as possible. This can cause display issues as other elements of the app (e.g., ad, loader, splash screen, etc) may close the In-App message or prevent Batch's SDK from displaying it.

You can avoid these issues by using the "Do Not Disturb" (DnD) mode. It allows you to tell Batch to hold on to a mobile landing for you and resume the In-App display once the app is fully loaded. You will find more information here: DnD mode.

4. Direct opens detection

Each time a push notification is opened directly, the Batch SDK must report a push open event.

Read more on how to test direct opens detection in our dedicated guide: Why are my "direct opens" stuck at 0?.

5. Opt-in request to display notifications

On Android 13 onwards, a system prompt should be displayed to users to allow them to opt in (or not) to receive push notifications.

We recommend that you display this as early in the user journey as possible (ideally during the user's 1st session after installation) to maximise opt-in collection.

See how to do it in our Requesting the notification permission documentation.

You can use deeplinks in your campaigns to direct users to a specific location in your application (for example: myapp://path/to/content).

To test if deeplinks are working, send a test notification to your device including a deeplink, and ensure that you are redirected to the expected page of your app after tapping the notification.

If the redirection is not working, refer to our dedicated guide: How to direct users to a page on my app?.

7. Custom data collection

What kind of custom data can I collect from the SDK?

In addition to the data the SDK collects natively, you can collect additional data to improve your segmentation, personalise your messages, or trigger In-App messages. Batch allows you to:

How to test the integration?

Use the profile view (Profile → Search profiles) to find your most recent installation, based on:

  • An Installation ID, which is an anonymous ID generated by Batch.

  • A Custom User ID, should be the unique user ID you are sending to Batch from the SDK.

Example of the profile view on the dashboard.
Example of a device view of a profile on the Dashboard.

The profile view shows all the native and custom data we have on your most recent installs:

  • Custom ID: This field shouldn't be empty if you are sending it to Batch and are logged into the app. Make sure that ID disappears after you log out.

  • Push token: This field should not be empty on Android. Double-check your logs to see if the SDK gives you more information on the issue.

  • Attributes/Events: Your attributes and events will appear in the right panel of the debug tool. Make sure important attributes are sent to Batch in the right format (e.g., date, string, boolean, etc) and at the right moment (e.g., on the first start of the app and/or when a value changes, etc). Events will appear as soon as you perform the tracked action in the app.

8. Data collection compliance

Data collection is triggered when the Batch SDK starts. You need to ensure that you have the necessary consent from your users for the data treatments that you implement.

Once you have determined the mechanism you want to implement, refer to our guide on how to integrate Batch with your consent management platform.

🚧 Optional: Implement Batch debugger

The debug view is a UI with multiple debug features, allowing you to see the native and custom data attached to your installation. You can also see the list of In-App campaigns already stored on your device.

This is useful for development purposes and for internal use only, especially if your team cannot use a Custom User ID to find their device in the Profile view and send test notifications to their device.

Here is how you start the debug activity:

public static void startDebugActivity(Context context)

🚧 Optional: Display the Installation ID

To ease debugging, our clients usually display the Installation ID somewhere in their app (e.g., on a page of the app settings). That installation ID can safely be exposed to your end users, who can then give it back to you if they are experiencing push trouble with their app.

Example of an installation ID visible in the mobile app.

You can find the Installation ID of a device by calling:

Batch.User.getInstallationID();

Last updated

Was this helpful?