Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to diagnose notifications that have a GCM outcome of 'Success' but don't reach the device

This is really a continuation of another question I posted, except now I'm using Azure's push notification telemetry and Google discontinued FCM diagnostics in the Play Console.

I get reports from users saying they haven't received notifications. But the Azure telemetry shows results like these, even for these notifications:

"GcmOutcomeCounts": {
    "Outcome": {
        "Name": "Success",
        "Count": "1"
    }
}

Crashlytics shows no crashes, so the only thing I've come up with is putting calls to a logging API in to see where it fails or stop working, but it never even reaches the app in this case.

There has to be a way of figuring out exactly where and why the notification fails. What is it?

like image 664
Questioner Avatar asked Oct 10 '18 13:10

Questioner


People also ask

Why user can't see notifications even though it was successfully sent to user's device?

It is possible that the user device didn't get properly configured into the push notifications provider when the app was first installed, reinstalling it might help with resolving such a situation.

What is GCM notification?

Google Cloud Messaging (GCM) was a mobile notification service developed by Google that enables third-party application developers to send notification data or information from developer-run servers to applications that target the Google Android Operating System, as well as applications or extensions developed for the ...

Which of the following can be a cause of push notifications not working?

You have all push notifications blocked by default on your browser. You have an extension such as an ad blocker which blocks receiving push notifications. You have reset the settings of the browser, that's why the service worker is removed. You have them blocked by default on your operating system.

How do I fix my GCM?

In order to fix the issue you can either: Migrate your old GCM project to Firebase, use it in Android Studio and send an updated version of your app to the Play Store. Or stick with the new project and add an additional Authorisation key on Batch's dashboard (in Settings > Push settings).


1 Answers

There has to be a way of figuring out exactly where and why the notification fails. What is it?

Here is my 2 cents. In general, there can be many points of failure for notifications. Your aim would be to figure out which at which point the issue lies. Below is the diagram from the home page of FCM:

Potential failure points:

  1. When the app sends registration token to your server.
  2. Handling update of the FCM registration token.

    • If there is an error sending registration token, then you can have a custom non-fatal exception send to Crashlytics. Since you already seem to have the token I don't think it is the issue. However in some cases the token might change, so just double check that you are implementing onNewToken() and sending the new registration token to server in case its changing.
  3. When sending notification from your server to FCM.

  4. When sending it from FCM to user device.

    • To confirm if there is no issue when sending the notification from your server -> FCM -> user device, you can try getting a delivery receipt from FCM as mentioned here: Receive delivery receipts. It says:

      For Android and Chrome client apps, you can get delivery receipts (sent from FCM to your app server) when a device confirms that it received a message sent by FCM.

      To enable this feature, the message your app server sends to FCM must include the field delivery_receipt_requested. When this field is set to true, FCM sends a delivery receipt when a device confirms that it received a particular message.

    • Also, I've seen sometimes issues with firewall on the user's network, back in days when there was GCM. There could be an issue where firewall is blocking the notification. IP range of google GCM push notification server? Try opening the potential list of ports if that's the case or try testing on carrier data network. Since you mention that you've to include log at various points in the app but it never reaches. Looking into the above points can be the next steps.

  5. Handling notification within your app / showing the notification in the notification drawer.

Hope this helps a bit in debugging your issue.

like image 133
Shobhit Puri Avatar answered Nov 15 '22 00:11

Shobhit Puri