Troubleshooting

If you are having trouble integrating the SDK, uploading your certificates or sending notifications, here are some suggestions.

Displaying a stable debug ID

The Installation ID is an ID generated by Batch for all the installs the first time your users open the app. You can safely display it in your app to simplify the debug process.

You can use that ID in the debug tool (Dashboard settings > Debug) to find your own install, see the data Batch has on it and send test notifications to your device.

Your end users can also send it to you so you can understand why they are not receiving push notifications or not seeing an In-App message. This is useful when your app doesn't share any advertising ID with Batch.

Debug iOS

You can also store the install ID on your end and reuse it later to target specific installs using the Transactional API.

Retrieving the installation ID

You can retrieve the installation ID by calling the following methods:

Batch.User.getInstallationID();

Displaying the installation ID

That installation ID can be exposed to your end users. You can insert it in a diagnostic email automatically generated when users report an issue from the app or hide it in an easter egg.

Example

Copying the installation ID

1.18 Batch will now copy the installation ID to the clipboard when the application appears in the foreground 4 times within 20 seconds. This is enabled by default, you can disable it at any time by using:

  • Kotlin
  • Java
class YourApp: Application() {

      override fun onCreate() {
            super.onCreate()
            // This can be called at any time, even before starting Batch.
            Batch.Debug.setDebugInstallationIdEnabled(false)
            //...
      }
}

Enabling internal logs

Internal logs can be useful to you or our support team to debug issues that might not be debuggable using public logs. They're disabled by default as they are very verbose by design.

They can be enabled on any device or emulator using adb:

adb shell setprop log.tag.BatchInternal VERBOSE

Once you've ran this command, you will need to fully restart the app's process: use Android Studio's run button or force kill the application.
Public logs are logged using the Batch Logcat tag, while internal ones use BatchInternal.

As properties set via ADB are not persisted, internal logs will be disabled after a reboot.

Note: This command will enable Batch internal logs for all applications. Use a tool like pidcat to easily filter them.

Implementing Batch debugger

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

Debugger overview

This is useful for development purposes and for internal uses only, especially if your team cannot use an advertising or a custom user id to find their device in the debug tool and send test notifications to their device.

Identifiers

Debugger native data

Shows a list of native information you can use for basic debug:

  • Batch SDK version
  • Installation ID
  • Advertising ID
  • Push token

You can easily share that report by clicking the share button in the top right corner.

Custom user data

Debugger custom data

Shows the custom user data attached to your install, excluding events. This is useful to:

  • Check the Custom User ID attached to the install (see more here).
  • See the list of attributes / tag collections attached to your install. You can use that part to see if the app has been tagged correctly or understand why your device didn't receive a notification based on a one of these information.

In-App campaigns

Debugger custom data

Use that part to manually pull the campaigns available on Batch servers for your install and to see the list of stored In-App campaigns. This requires Batch to be started.

Implementing the debugger

Here is how you start the debug activity:

public static void startDebugActivity(Context context)

You can hide it in an easter egg (e.g. display it after 10 taps on specific button, etc) or simply display it in your app settings for your development versions exclusively.

Integration issues

Unable to resolve dependency [...]: Could not find any version that matches com.batch.android:batch-sdk:1.12+.

Batch is published to Maven Central. Sometimes, jCenter does not correctly mirror it, breaking the auto update of the artifacts.
To fix this, either switch to an explicit version (such as 1.12.0 rather than 1.12+), or add mavenCentral() to your repositories in your build.gradle.

Unable to use FCM because the Google Play Services library is not integrated correctly

Please ensure you added the Play Services library in the dependencies. If you use Proguard ("minifyEnabled=true" in the Gradle build), make sure you have added Batch's Proguard rules.

The number of collected tokens is not increasing

If you use Proguard, please make sure you have added Batch's Proguard rules. If your integration worked on the debug builds, it is probably because Proguard was disabled on that configuration.

Batch is not showing the direct open rate of my campaigns

This usually happens when the SDK is not integrated in ALL your activities.

User data editor - Error while applying

Please make sure you call Batch.User methods after Batch.onStart() and before Batch.onStop().

Common issues

Unable to find a start event for [appname]

There are several points you should check if Batch is unable to find a start event for your app:

  • Integration issue: See if Batch is integrated in all your activities.
  • Wrong API key: Make sure you are using a valid API Key (⚙ Settings → General).
  • Emulator. Make sure you are testing on a real device (unless you're using Google API emulators).
  • Logcat: Look for errors in logcat to understand why Batch is not starting in your app.

Unable to find a token for [appname]

If Batch is unable to find a token, here are some suggestions to find the issue:

  • Emulator. Make sure you are testing on a real device since Batch relies on the Play Services for push services (unless you're using Google API emulators).
  • Google Play services. See if you are using the most recent version of the Google Play Services by opening this link on your device.

My device doesn't seem to receive any notifications

Here are several points that may help:

  • Network. Try turning off and on your WiFi connection or using a 3G/4G connection.
  • Integration issue. See if Batch is registering a push token in your logs or if there are errors in your device logcat.
  • Force close. Go to the system settings → Apps. Make sure your app is not force closed, otherwise it won't receive any notifications.
  • Energy saving. Some energy saving features may kill the apps (Samsung Smart Manager) or delay push delivery when the device is low on battery (Doze). Try changing the priority of your push to see if that fixes the issue.

You can also check the status of every message sent to a specific device token (received, device disconnected, etc) using the FCM Diagnostics from the Google Play Developer Console.

FCM Diagnostics

My device's screen turn black, System.UI keeps crashing

If your device become unusable, the screen blinks or turn black every time your receive a push notification from Batch, it might come from your small icon.

Starting in Android Oreo, a new drawable type has been introduced: AdaptiveIconDrawable. That type of drawable isn't handle well by the system.ui process and it crashs when trying to draw them to the screen.

This can happen if your set a R.mipmap as the small icon of your notification, using Batch.Push.setSmallIconResourceId() or from the meta com.batch.android.push.smallicon in your app's manifest.

To resolve this issue, make sure to use a standard drawable as your small icon.

Note: On some devices (Samsung or Xiaomi for example) the system.ui process can crash if your small icon is too big. To ensure a better compatibility make sure to follow our small icon guidelines.

I’m not seeing any data on my dashboard

There are several points you should check if Batch doesn't show any data on your dashboard:

  • Dev/Live API key. Make sure that you used the Live API key in the build you uploaded to the store. Stats are only displayed for the Live API key.
  • 24h delay. Installs, DAU, starts and redeems shown on the Analytics tab are updated on a 24h basis for the Live API key.
  • Integration issue. If you still don't see any stats for your app 24h after changing the API key, see if you find anything related to Batch in your logs and double check your integration using the documentation.

Testing issues

Unable to send your test message: FCM did not accept the authorization key

Tokens are linked to a single project ID. Make sure the Service Account Key used in Batch's dashboard (⚙️ Settings → Push settings) matches the FCM project ID used in your app. You will find more information here.

Error while requesting push token to FCM: SERVICE_NOT_AVAILABLE

This error happens when FCM is not available for a short period of time. Try again later or fallback on cellular network.

Unable to send your test message: Bad Request

Please reach us at support@batch.com. Our team will help you to fix the issue.

FCM/internal errors

You can find the list of FCM and Batch internal errors in the Notifications tab, by hovering on the error count.

fcm_third_party_auth_error

FCM refused the credentials supplied in your app configuration.

fcm_unregistered

FCM sends this error when the token Batch tries to push is not valid anymore. This usually happens when users uninstall/reinstall your app.

fcm_sender_id_mismatch

On Android, tokens are linked to a specific project ID. FCM will systematically send this error when a token is pushed with the wrong project ID. Make sure you are using the same project ID you were using with your old push provider.

max_retry_attempts

This internal error happens when the number of maximum send attempts is reached for a token. Feel free to reach us if you are seeing to many max_retry_attemps errors.

AT Internet SDK and the Batch AT Internet dispatcher

AT Internet provide you two ways to integrate their SDK:

  • Download the AAR file from their website, which include the configuration from your AT account
  • Add the maven repository from jCenter in your gradle.build file, and provide the configuration during the initialization

Both are compatible with the Batch AT Internet dispatcher, but when using the AAR file, you might get duplicate classes errors, similar to:

Duplicate class com.atinternet.tracker.ATFrameLayout found in modules jetified-Tracker-2.14.0-runtime (com.atinternet:Tracker:2.14.0) and jetified-Tracker-runtime (Tracker.aar)

This is because the dispatcher has a strong dependency to the AT Internet's maven repository, which automatically download and include the Tracker. So when you also include the AAR file, the Tracker end up being added twice.

To fix the issue, you can tell gradle to exclude the dispatcher's dependency, like so:

implementation ('com.batch.android:atinternet-dispatcher:1.0.0') {
      exclude group: 'com.atinternet', module: 'Tracker'
}