FCM Troubleshooting

When you are stuck with the FCM-based push notification implementation, See the following items:

  1. Does your development environment satisfy the requirement?

    To leverage the FCM feature, you need to satisfy several requirements such as using a device running Android 2.3 or later. See the Firebase official documentation for more details.

  2. Are you using the correct access keys?

    The sender and receiver must be the same Kii application, meaning that they have to use the same AppID.

  3. Is the private key issued correctly?

    Ensure that you generate a private key following the procedures in our tutorial. Also, ensure that the private key is registered to Kii Cloud as the service account key on the developer portal.

  4. Did you set the API key on the Kii Cloud developer portal?

    You need to set the server key you've got on the Firebase console.

  5. Does your application contain the Google Play services project?

    You need to integrate the Google Play services in your mobile app project so as to include it as a library.

    Check that you do not have any error shown on the console or in the log, though the library should be included automatically if you follow the steps described in the tutorial.

  6. Did you make the necessary changes in the AndroidManifest.xml file?

    Update the AndroidManifest.xml file by following the steps described in the tutorial. Also make sure that your updates on the AndroidManifest.xml are correct (e.g. the package name is updated to match with your mobile app).

  7. Did you set the development/production correctly?

    You need to select the correct environment. Make sure that you selected the correct environment in the following steps:

    • When you initialize the Kii Cloud push notification feature (some APIs will apply the production environment as default).
    • When sending a push message (e.g. sending from the developer portal or sending via API).
  8. Does your mobile app project have a subclass of the FirebaseMessagingService?

    Make sure that a subclass of the FirebaseMessagingService has been added to your project and android:name in <service> tag in AndroidManifest.xml has it.

  9. Did you install your device while a user is logged in?

    You need to install a device by executing the KiiUser.pushInstallation().install() method while a KiiUser is logged in.

    If you have not done this, add a device installation logic like one described in the sample code. If you use the sample code without any changes, check the username and password of the test user.

  10. Is the initialization process running ok?

    Check if the initialization process is running correctly (e.g. with a debugger) by looking for any errors thrown.

    Then check to see if the device installation succeeds. You should be able to find the string that looks like the device token.

  11. Has the handler been called?

    When the device receives an FCM push message, you will see nothing unless you have implemented a logic to display push messages. Check the handler's behavior by setting breakpoints with the debugger.

  12. Are you using the correct bucket/topic scope?

    Make sure that the scope you've subscribed to and the scope that triggered the push messages match.

    • If you are using the Push to App messages, double check if the bucket scope matches.
    • If you are using the Push to User messages, double check if the topic scope matches.

    For example, the following Android Push to App sample does not work properly because the subscription is made in the application scope while the updating is made in the user scope.

    • Subscribed topic: Kii.bucket("myBucket");
    • Updated topic: user.bucket("myBucket");
  13. Did you check the developer log?

    You might find some push-related information in the developer log.

    When an error occurs on a Kii Cloud API, the failure reason is sometimes recorded in the developer log. By inspecting the developer log, you might find some hints to resolve the issue.

    Here is an example of the message recorded in the developer log when the FCM payload exceeds 4096 bytes.

    2015-01-21T14:51:16.159+09:00 [ERROR] push.send description:Failed to send Push Message sender: origin:EXPLICIT messageID: type: succeeded-endpoints: failed-endpoints: exception:There are validation errors: payload - The size of the payload exceeds the maximum allowed for GCM messages: 4096 bytes.
    
  14. Did you set the collapse_key?

    If you've sent multiple FCM push messages but received only one push message, you might have set the collapse_key enabled. See the description by Google for more information on the collapse_key.

  15. Does the issue occur only on Android 8.0 or later?

    Your app might not be setting a notification channel if a push notification does not show up on the status bar only on Android 8.0 or later. See Showing a message on the status bar for the details.

    Note that although a message will not appear on the status bar without a notification channel, the push notification itself is delivered to the app.