GCM notifications not always getting sent unless I reinstall app

Richard Wilde 1 Reputation point
2022-02-22T16:09:13.623+00:00

I am having intermittent issue with Azure Notification hubs sending notifications to Android devices.

Everything is configured, everythings works, however

It works for a while, then suddenly stops. When doing a test via the Azure Portal using a single tag to a single device the response is:-

"Message was successfully sent, but there were no matching targets."

If I uninstall the app from my device (tested on two devices) and reinstall everything works fine again. I get a token etc and can send test notifications to the devices.

The system does not send many messages, a couple a month to individual devices.

According to the metrics the system is sending messages to GCM, however

I am wondering if there is a deactivation/suspend time for Android e.g. the token expires or something, is there is something I must do in code?

IOS all fine

Does anyone else see this behaviour? How can I debug it? How can I resolve it?

I have just come across this https://stackoverflow.com/questions/46725467/apns-bad-channel-error-on-notification-hub-test-push-send

and seen this in the metrics for GCM Bad Channel Error

176931-2022-02-22-16-04-34.png

Messages are going through but just not on all devices from what I am seeing

176816-2022-02-22-16-07-05.png

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
383 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2022-02-23T12:36:58.503+00:00

    RichardWilde-9108, Thanks for posting this question here.

    As mentioned in this doc, Google has deprecated Google Cloud Messaging (GCM). The GCM server and client APIs are deprecated and will be removed*.
    Perhaps the reason for the intermittent issue that you’re facing. You may want to migrate to Firebase Cloud Messaging (FCM).

    Please check the tutorial: Send push notifications to Android devices using Firebase SDK version 0.6

    Additionally,
    If the push notification service remains unreachable for 30 minutes, there's a policy in place to expire and drop the messages permanently.

    If a push notification service attempts to deliver a notification but the device is offline, the notification is stored by the push notification service. It's stored for only a limited period of time. The notification is delivered to the device when the device becomes available.

    During the estimated delivery time, the service calculates the targets per platform and routes messages to the Push Notification Service (PNS) based on the registered tags or tag expressions. It is the responsibility of the PNS to send notifications to the device.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.