Error Couldn T Get Gcm Token for Device

Error Couldn T Get Gcm Token for Device

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 starting time fourth dimension your users open the app. Yous tin safely brandish it in your app to simplify the debug process.

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

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

Debug iOS

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

Retrieving the installation ID

You can retrieve the installation ID past calling the post-obit 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

one.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:

  • Java
  • Kotlin
                                                            public                                                      class                                                      YourApp                                                      extends                                                      Application                                      {                                                                                                                                              @                  Override                                                                                                                  public                                                      void                                                      onCreate                  () {                                                                                                                  super                  .                  onCreate                  ();                                                                                                                  // This can be called at any time, even before starting Batch.                                                                                                  Batch.                  setFindMyInstallationEnabled                  (                  false                  );                                                                                                                  //...                                                                                                  }                                                                              }                                                    

Enabling internal logs

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

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

                                                    adb beat setprop log.tag.BatchInternal VERBOSE                                            

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

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

Note: This control 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, assuasive y'all to encounter the native and custom data attached to your install. You lot can also run into the list of In-App campaigns already stored in your device.

Debugger overview

This is useful for development purposes and for internal uses simply, particularly if your team cannot utilise an advertizing or a custom user id to notice 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
  • Button token

You tin easily share that report by clicking the share button in the top correct corner.

Custom user data

Debugger custom data

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

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

In-App campaigns

Debugger custom data

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

Implementing the debugger

Here is how you lot start the debug activity:

                                                    public                                                static                                                void                                                startDebugActivity                (                Context                                  context)                                            

You tin can hibernate it in an easter egg (e.one thousand. brandish it afterward 10 taps on specific button, etc) or merely display information technology in your app settings for your evolution versions exclusively.

Integration issues

Unable to resolve dependency [...]: Could not detect 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 motorcar update of the artifacts.
To fix this, either switch to an explicit version (such as i.12.0 rather than 1.12+), or add mavenCentral() to your repositories in your build.gradle.

Unable to use GCM considering the Google Play Services library is non integrated correctly

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

The number of nerveless tokens is non increasing

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

Batch is not showing the directly open rate of my campaigns

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

User data editor - Mistake while applying

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

Common problems

Unable to find a start effect for [appname]

There are several points you lot should check if Batch is unable to detect a start outcome for your app:

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

Unable to find a token for [appname]

If Batch is unable to observe a token, hither 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).
  • GCM sender ID. Bank check if you have gear up the GCM sender ID in your code as described here.
  • Google Play services. See if y'all 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 assist:

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

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

FCM Diagnostics

My device's screen plough black, Organisation.UI keeps crashing

If your device go unusable, the screen blinks or plow black every fourth dimension your receive a push notification from Batch, it might come from your minor icon.

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

This tin 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 button.smallicon in your app's manifest.

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

Note: On some devices (Samsung or Xiaomi for example) the organisation.ui procedure tin crash if your small icon is too large. To ensure a better compatibility make sure to follow our pocket-sized icon guidelines.

I'chiliad not seeing any data on my dashboard

At that place are several points you should bank check if Batch doesn't show any data on your dashboard:

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

Testing issues

GCM tokens are linked to a single Sender ID. Make sure the GCM Server API Key used in Batch's dashboard (⚙️ Settings → Push button settings) matches the GCM sender ID used in your app. You will notice more than data here.

Error while requesting push token to GCM: SERVICE_NOT_AVAILABLE

This mistake happens when GCM is not available for a curt period of fourth dimension. Try again subsequently or fallback on cellular network.

Unable to send your exam message: Bad Request

Please attain united states at support@batch.com. Our team will help y'all to fix the issue.

FCM/internal errors

Yous can find the listing of GCM and Batch internal errors in the Notifications tab, by hovering on the error count.

gcm_authentication

GCM/FCM refused the credentials supplied in your app configuration

gcm_invalid_registration

GCM sends this mistake when the token Batch tries to push is non valid anymore. This normally happens when users uninstall/reinstall your app.

gcm_mismatch_sender_id

On Android, tokens are linked to a specific sender ID. GCM will systematically send this fault when a token is pushed with the wrong sender ID. Make certain yous are using the same Sender ID you were using with your onetime push provider.

max_retry_attempts

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

If the number of max_retry_attempts error of a sudden increases, brand sure you are using a "Server API primal" to communicate with GCM (Developer dashboard → Credentials → API keys). If you are using an Android API key, you should generate a new Server API key and paste it in Batch's dashboard (⚙️ Settings → Push settings).

AT Internet SDK and the Batch AT Cyberspace 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, only when using the AAR file, you might get duplicate classes errors, like to:

                                    Indistinguishable class com.atinternet.tracker.ATFrameLayout found in modules jetified-Tracker-2.14.0-runtime (com.atinternet:Tracker:2.fourteen.0) and jetified-Tracker-runtime (Tracker.aar)                              

This is because the dispatcher has a stiff 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 stop up beingness added twice.

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

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

Error Couldn T Get Gcm Token for Device

Posted by: edwardfortint.blogspot.com

Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : Error Couldn T Get Gcm Token for Device

0 commentaires:

Enregistrer un commentaire