Platform-Knowledge-Base/troubleshooting/troubleshooting-android-pus...

2.9 KiB

title description type page_title slug position tags teampulseid ticketid pitsid
Push Notifications to Android Stopped Working Sending push notifications to Android throws "Error authenticating to Google Cloud Messaging" troubleshooting Unsuccessful authentication to Google Cloud Messaging troubleshooting-android-push-notifications-stopped-working Google Cloud Messaging, GCM, Android, push notifications, FCM 1044096, 1045723

Environment

Service Notifications (Backend Services)
Feature Push Notifications, Android

Description

Your Android app suddenly stopped receiving push notifications. The {{site.tp}} portal shows the following error message in the details pane for the failed push notification: Error authenticating to Google Cloud Messaging server.

Error Message

Error authenticating to Google Cloud Messaging server.

Cause

The error signifies that {{site.tp}} cannot authenticate to Google Cloud Messaging (GCM). Due to recent changes in the GCM infrastructure, the Google API key that you entered in {{site.tp}} may no longer be accepted by Google for authentication to GCM.

Solution

Verify that the Google API key entered in {{site.tp}} for your app is a Server API key.

Check the type of your Android API key:

  1. Open the Google Developers console.
  2. From the projects list select your project—look for the number used to subscribe the mobile app for push notifications (passed as senderId in the mobile app).
  3. On the left, click Credentials.
  4. In the API keys list, find the Google API key used in {{site.tp}}.
  5. Verify that the key type is Server. Other key types such as Android, Browser, or iOS are not supported.
  6. If the key type is not Server, issue a Server API key and enter it in {{site.tp}}. Take these steps:
  7. On the Credentials screen of your project in the Google Cloud Console, click Create credentials.
  8. From the list of available credentials types, choose API key.
  9. Select the Server key option (other key types are not supported).
  10. Name the key as you find appropriate.
  11. Leave the IP addresses field blank.
    The key will reside in {{site.tp}} and will not be exposed to third parties. It is used only in the server-to-server communication between {{site.tp}} and GCM.
  12. Click Create.
  13. Copy the generated key and paste it in your {{site.tp}} app in Notifications > Push Notifications > Push Settings > Android.
  14. Save the Settings.
  15. Test your setting by sending a push notification.

See Also