Support

How do I troubleshoot issues with Push Notifications on Android?

If you are having trouble with Push, the first place you should check is the Logs in the dashboard.  It will show you if a device was properly registered for pushes and if/when a push was successfully sent.

If you do not see something that looks like "Push: Registered gcm device for participant with identifier <user_id>" when authenticating a user on an actual device with Google Play Services, verify that your Google Project is configured correctly by following this guide.

Keep in mind that push notifications will only work on actual hardware (not emulators) with Google Cloud Services installed.

Verify that the message sender is setting the push notification message in the MessageOptions object:

    //Formats the push notification text
    MessageOptions options = new MessageOptions();
    options.pushNotificationMessage(userName + ": " + text);

    //Creates and returns a new message containing the options and message parts
    Message message = layerClient.newMessage(options, Arrays.asList(messagePart));

    //Sends the message
    conversation.send(message);

You should make sure the AndroidManifest is formatted correctly. If you put your Layer App ID and GCM Sender ID into the Quick Start App push notifications work when you send messages from the simulator to the device (and the app is in the background), compare your AndroidManifest file to the one provided.

By default, push notifications are only called when the app is in the background, so if the Layer Client was created during an activity state transition, it may not know what state the app is in. To solve this problem, call LayerClient.applicationCreated(this); in your Application.onCreated() method before creating a new LayerClient instance.

 

Have more questions? Submit a request