Many errors sending push notification with the Apigee console - push-notification

We have an iOS app which is able to receive push notification through the Apigee SDK.
The push notifications are sent by using the Apigee admin console.
Within the console, we configured both dev and prod environments. The prod environment is used for the app published in the App Store. In both cases, the push notifications are well received by our iPhone devices.
However, my question is about the status displayed in the Message History section of the Apigee console.
In the case of the dev notifier, the console display the message : Finished (with errors) with by example, a total sent of 660 for a total errors of 1318.
I don't well understand these figures and I don't know where they are documented.
Is the total sent figure for the number of devices to which the push is sent? However, we don't have as many devices with the dev app version installed
The devices we have with the dev app version installed have well received the push as expected so why are there as many errors?
The detail of the error message is: "INVALID_TOKEN: Failed sending notification."
Thanks very much for your help

We have a bug where statistics get calculated inaccurately if you have errors from the Apns service since they come back asynchronously.
Invalid Token usually means the device is not registered with the apple push notifications service anymore.

Related

Push Notification not work correctly in custom app [Rocket.chat]

I followed the instructions in the Rocket.chat documentation:
Removed the check mark from the gateway
added GCM keys from firebase
rebooted the server
Pushs seem to come, but the listener "pushnotificationreceived" is triggered only if I open the application immediately after the push should come or I am in the application during the push, if I have minimized the application and send myself a message, then there is no push.
If I throw the push myself through the firebase API, then the push works out as needed.
There is a suspicion that this is due to the fact that Rocket.chat sends push data in the data key, not notification (https://github.com/RocketChat/Rocket.Chat/blob/develop/app/push/server/gcm.js).
I also have an error in the Rocket logs.Chat:
"For devices running Android 8.0 or later, you need to specify the android_channel_id identifier. See https://github.com/raix/push/issues/341 for more information", but even with this error, push writes that it was sent successfully.
Please, checkout this post:
https://forums.rocket.chat/t/apple-push-notification-service-update-from-legacy-binary-protocol/12425/4
Also, consider asking dev questions at:
https://open.rocket.chat/channel/dev

Firebase Cloud Messaging - Identify delivery status for a particular push notification message

Is it possible to identify whether a particular push notification message was delivered to a particular token via Firebase Cloud Messaging? And, if so, is it possible to do so via an API call or by listening to some callback?
I know that I can look at aggregate statistics in the console and even segment those statistics through analytics tags, but cannot find a way to get more discrete information.
I also know that the API will synchronously respond if a token is invalid but the process by which Apple and Google invalidate tokens is a bit opaque (to me) and doesn't help if someone simply turned off push notifications for my app.
Thanks!
Jason
If someone turned off push notification – you can check it with code
Swift ios check if remote push notifications are enabled in ios9 and ios10
Android app - detect if app push notification is off
But user can be offline, or APNs / Firebase service – can get some problems and your notification will be drop. You can check delivery status with some code in iOS and Android applications.
If you need check, delivery status for some push you can make push notification extension (in iOS). For send status about delivered notification in your API. More info about push notification extension.
https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension
It can be helpful
https://developer.apple.com/documentation/usernotifications
https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications
https://firebase.google.com/docs/cloud-messaging/understand-delivery
https://firebase.google.com/docs/cloud-messaging/android/receive#handling_messages About handling messages in Android (you can send status delivered too)
I hope this answer will help with your problem.
UPD:
https://firebase.google.com/docs/cloud-messaging/understand-delivery
Received (available only on Android devices) — The data message or
notification message has been received by the app. This data is
available when the receiving Android device has FCM SDK 18.0.1 or
higher installed.

Firebase cloud messaging message log

In my Android app I receive messages sent using Firebase, the problem is not all messages arrive and sometimes messages arrival is very slow.
In my server side I track the messages I send to FCM and I always receive success: 1 response from FCM, still there are messages I do not receive in my Android app.
I thought an FCM messages log would be a great help in cases like described above but I don't sure if this option exist.
Is there a way to browse Firebase Messages log ?
First of all, did you know that Firebase Cloud Messages can be delayed if the connected device is in doze mode and your app's standby bucket is not high enough to wake up the device? Therefore, even if FCM sends the message to your target device in time, there is still a chance that it will be delayed by the Android platform. Also, if the message is sent with high priority, you might have a chance to wake up the device from doze mode to be able to receive the message in time.
The following two docs will give you a more detailed explanation:
https://developer.android.com/training/monitoring-device-state/doze-standby
https://developer.android.com/topic/performance/power/power-details
Besides, FCM provides three sets of tools to help you get insight into message delivery:
Firebase console message delivery reports (go to Firebase Console -> Messaging -> Reports)
Aggregated Android SDK delivery metrics from the Firebase Cloud Messaging Data API
Comprehensive data export to Google BigQuery
All these three tools can help you understand your message delivery, the following docs have a pretty good explanation about how to use them:
https://medium.com/firebase-developers/what-is-fcm-aggregated-delivery-data-d6d68396b83b
https://firebase.google.com/docs/cloud-messaging/understand-delivery?platform=android#count-data-messages-sent

How to View Firebase Notification Delivery Reports?

We use Firebase to send push notifications to both Android and iOS devices. We use Http (not XMPP).
How to get delivery reports for push notifications? We want to check if a push is delivered to devices (both Android and iOS).
I cannot see any stats or reports in Firebase console.
Please help.
As seen in the Possible Duplicate Post I linked, there is currently no available reports for FCM, other than what can be seen in the Firebase Console (if you sent the message using the console) and using the Diagnostics/Statistics tool in your Play Dev Console.
There is no API that retrieves these FCM log details as of the moment. However, there's been a recent improvement in the Firebase Notifications console where stats (sent count only for now) for messages sent using the FCM API is included in the Firebase Notification console stats. From my answer in the similar post:
As of August 2018, stats for messages sent using the FCM API are now visible from the console. From the Cloud Messaging section, click on the Reports tab. From there, you will be able to filter by message type (notification, data, and all)
It would seem that the Impressions and Opens are still only available for messages sent using the console. But Sends for sure now counts the messages sent using the FCM API.
Reference: https://firebase.googleblog.com/2018/08/in-app-messaging-crashlytics.html
Our findings: In order to view statistics for Data messages, the data messages will need to include an analytics label. Check to make sure that these are included. It is just a label, https://firebase.google.com/docs/cloud-messaging/understand-delivery#adding-analytics-labels-to-messages so even without the analytics label, the message should still be sent. It just won't be tracked by their reporting. Data messages do not automatically generate a notification though. Different app states and message types will have different message receiving behavior. A data message should be received in onMessage or setBackgroundMessageHandler for JavaScript clients. Try checking these callbacks to see if the message is received there. I'd highly recommend checking out the quickstart, which should be working fine. You can use it as a base to build off or reference to compare with your app to identify potential problem areas. So our understanding is that it needs to be handled properly on the mobile end, https://firebase.google.com/docs/cloud-messaging/js/receive (though this is the javascript client, it will still apply to mobile).
You can rather go to the Google cloud console to check messages sent.
Select period from available options on top right of the page.
https://console.cloud.google.com/apis/dashboard?folder=&organizationId=&project=[project-name]
The delivery report added to the FCM:
Received (available only on Android devices) — The data message or notification message has been received by the app. This data is available when the receiving Android device has FCM SDK 18.0.1 or higher installed.
https://firebase.google.com/docs/cloud-messaging/understand-delivery#message-delivery-reports

Accessing FCM message logs

I'm having trouble figuring out whether or not FCM keeps logs of sent FCM push notifications, and if so, how to access them. I'm having intermittent issues with sending push notifications from an FCM server to an iphone app, and would love to be able to see at what stage the push is failing.
I found the below documentation that suggests that these logs should be kept somewhere:
https://support.google.com/googleplay/android-developer/answer/2663268?hl=en
("You can look up messages sent through Firebase Cloud Messaging with a registration token or message ID.")
However, I can't seem to figure out how to access them. Since my app is currently iOS only, I don't have an app in the Google Play Developer console, and my firebase console doesn't seem to contain any such logs. However, based on the possible message statuses in the documentation above (e.g. Accepted, sent to APNS), it seems like google / firebase should store message logs sent to iOS as well as to Android.
Thanks in advance for your help!

Resources