GCM/FCM Troubleshooting Guide

If any of the following errors are showing in your dashboard Error Console, there is a configuration issue with Google Cloud Messaging (GCM) or your Firebase Cloud Message (FCM): 

  • Received error: Received push with missing authorization on platform GCM
  • Received error: Received push with invalid authorization on platform GCM
  • Application does not have permission to send to this device.
  • Original Message: Error: mismatched sender ID

 

 For example:

           Error_console.png

 

           ProjectError.png

 

Check the GCM or FCM Server API Key

If it appears that your push notifications are no longer being received on Android devices, it is possible that you are using the Android API Key rather than the Server API Key to identify your project in Urban Airship.

To fix this issue, create a new key by completing the following steps:

For GCM: logging in to your Google Developers Console:

    1. Log in to your Google Developers Console and click the hamburger icon in the upper left to show the left menu

                           ProjectHam.png 

    1. Choose API Manager.

                           ProjectAPI.png

    1. Choose Credentials.

                           ProjectCred.png

    1. On the Credentials page, click Create Credentials, then choose API key.

    2. On the Create a new key popup, choose Server key as shown below:                          gcm_server_key.png

For FCM: logging in to the Firebase site:

    1. Select your project.

                           

    1. Choose Project Settings after selecting the settings gear.   
                             
    1. Choose Cloud Messaging to view your Server Keys. Either of these keys can be used in our system.            
                                       

    • Ensure that this is the Key used in configuring the Google Cloud Messaging (GCM) services in the Urban Airship Dashboard as described in the documentation: Configure GCM and FCM in Urban Airship Dashboard. The Server Key should go in the API key field: 

                           gcm-add-gcm-api-key1.png

 

Check the Sender ID:

For GCM:

  1.  Navigate to the Google Developers Console dashboard:

       Projects.png 

  1. This will open the Dashboard for the project. Choose the project name by clicking it in the list of projects or selecting it from the Select a project dropdown menu, then click Settings

       ProjectID.png 

  1. The Project number is the gcmSender ID.  Verify that the gcmSender setting in your app's airshipconfig.properties file matches this Project Number, and is not set to the Project ID. Do not enclose the number in quotation marks. It should look similar to this in your airshipconfig.properties file: gcmSender = 123456789012  

For FCM:

    1. Select your project.

                           

    1. Choose Project Settings after selecting the settings gear.

                         

    1. Choose Cloud Messaging to view your Sender ID

                 

 

Double check the Package Name, if this is set for your project:

For GCM:

  • Select API Manager after selecting your project.

  • Select Credentials then edit on your Server Key.

  • Make sure the Package name is the same as the one you used for your application. 

 

For FCM:

  1. To find your Package Name in FCM, Choose Project Settings after selecting the settings gear:     

                  

    2. If you have a Package Name configured, it will be displayed here:

Other common things to check:

  • If you are seeing the error Received error: Received push with missing authorization on platform GCM, check that Google Cloud Messaging is enabled in the Google Developers console: 
    1. Navigate to the Google Developers Console dashboard.
    2. Click the hamburger icon to open the left menu.
    3. Choose API Manager.
    4. Under Mobile APIs, choose Google Cloud Messaging
    5. Click the Enable button.
  • Background data needs to be enabled on devices. Otherwise pushes can't send from GCM to Android devices until they have active WiFi connection. To enable background data for each version of Android OS, please consult Android documentation.
  • Notifications are not enabled for the application itself. Notifications are enabled or disabled in the Manage Applications screen. Navigate there for each Android OS by selecting Show Notifications.
  • If you're testing a production build, the inProduction flag in your code should be set to true. Otherwise, it should be set to false.​​
  • The Mismatched Sender ID error happens when your Sender ID is incorrect. Ensure you're using your project number, not ID.

Related Content: