FCM Push notifications 1000 users limit at a time issue - android

I am using FCM to send push notifications to all my android app users to tell them about new poetry and wallpapers/backgrounds added to server
Its working is like this:
When user install android app first time its device token is received on our server via rest API written in php on server side and we are sending push notifications to user as soon as new wallpaper is available done via their device tokens received on our server by getting these from database in array and passing that array to FCM CURL Call in php
Our Issue:
Limit reached can not be exceeded from 1000 tokens at a time
Our tries to solve that:
We are sending now with for loop of each 900 users at a time in php and calling CURL to FCM in php for each 900 users again and again.
Now notification are being received on some device and some are missing.
Tell me how can I reliably send notifications to all devices without any limit issue instantly?

There is a very easy solution to that. If you want to send notification to a group of users, you just have to subscribe them to a topic. For that you can use one line of code in your app FirebaseMessaging.getInstance().subscribeToTopic("<topicName>");. A few hours after the first user subscribed to the topic, you will also be able to see it in the Firebase console. You can also subscribe users to topics using the Firebase Admin SDK.
Android
Admin SDK

Related

Android FCM push logs

I want to see all the logs of push notifications received on my android device. I'm sending the FCM token of my device to my backend server, and the push is sent using PHP code to my device.
Does firebase console provide any statistics/logs of all push received for the specific device?
Firebase doesn't keep the track of device-specific notifications.
Instead, what you can do is while sending notifications from the back-end, just keep the track of notifications sent to specific devices by storing this data on your database, and then you can fetch it on your android device.
you could do kinda of that. Using analytics labels (only with FCM API v1) you can see on the firebase console the stats about received messages. If you use a specific label only for your device, you will know how many notification have been received by that specific device.
https://firebase.google.com/docs/cloud-messaging/understand-delivery?platform=android

Send push notifications using Google console

I did create a GCM account for my app to receive push notifications, now there is a new update which is mandatory for the users to download otherwise they will loos a lot of app functionalities due to server side issues.
So, when trying to send the users a notification to inform them about how important this update is, I couldn't find any way to send notifications in Google console like in Firebase console if I'm using FCM:
and upon searching, I found some tools like pushWatch, but there is no tool that can handle this huge amount of device ids, also it whole fails if there is at least one single device is already updated and can't receive it.
p.s. the update contains a new server APIkey.
There is currently no option to send messages to all your users using the FCM REST API without specifying a target (registration tokens). The option to send a message to all users is only available through the Firebase Notifications Console.
So from the comments, if all you need is a way to send messages without an App Server, you could simply send a request using Postman or cURL.

Meteor - How to send notification to user on android?

I'm very new in meteor and I just made a simple app that show news (text) for a school, the problem is that no one knows when they write something new because the app doesn't have notification. I can't figure out how to use raix:push or richsilv:cordova-notifications because the test of raix:push didn't work in my device (android) and richsilv:cordova-notifications just work with android and I couldn't make it automatic. Saying "automatic" I mean "when the mongo collection is updated a notification is sent"
I think you may need to set up push server for sending notification to Android client.
Google is providing such option, where client app has to register with GCM server. On successful registration, google will give reg Id, which has to be stored in DB.
From your server make HTTP request to GCM server with Reg Id and message. GCM will deliver the message to appropriate device.
Please refer https://developers.google.com/cloud-messaging/gcm

GCM between User to User from same Android App

I would like to implement GCM in my Android app:
One Android app
Registered- U_user and another M_user.
I have Google Sign In in my app thats works fine with JSON and GSON and local MySQL database server with tomcat-server restutil to keep storing Gmail login users.
So, I want to send a notification from U_user to M_user.
U_user does a registration that has been pushed to M_user.
How can I do this?
I am assuming you mean the same Android app installed on different phones (U_user's phone and a separate phone for M_user).
To quote a section in the docs:
To make sure that messages go to the intended user:
Your app server can maintain a mapping between the current user and the registration ID.
The app can then check to ensure that messages it receives match the logged in user.
What this means is that you can send messages to another user through GCM. To let the app server know what to send to M_user, let U_user send an upstream message to your GCM app server (only possible in app servers using XMPP - see here). Alternatively, you have the option to do POST requests to your app server via HttpUrlConnection (can work on both XMPP- and HTTP-based GCM app servers).
Regardless of which method you use, specify in these messages to the server that you would like to send a message to M_user.

Android GCM delivery monitoring

I am developing mobile client for emailing service. One of the key features is notifications about new messages in the mailbox. As recommended by GCM architecture guidelines we are using a "Pusher" that is responsible for sending messages to the Google servers once we received a new message. The issue is that testing process has reported about serious problems with push notification delivery to devices.
So the question: is there an approaches for monitoring average statistics about push notification delivery percentage, time etc? Or maybe somebody have experience in how to set up test environment for efficient monitoring of how much notifications are getting lost during the application work?
All the "tips&tricks" related to the improving Android GCM experience are welcome.
Google claims that the processing at their GCM server takes less than a millisecond. Link below for a great video on GCM from Google's developer. And it's believable coz I could get push notifications almost instantaneously using my company's server to my device now.
http://www.youtube.com/watch?v=YoaP6hcDctM
They don't guarantee delivery, but they try for a max of 4 weeks to deliver the message depending on the duration you set in the message you send to Google's GCM servers and if you wish to let Google keep the data for eventual delivery of message to the device in case the device was offline when the message was to be delivered.
However, there are certain conditions under which the GCM messages are not delivered.
Background data is unchecked under Account and Sync settings.
Prior to 4.0.4.(ICS), a Google account on the device is a pre-requisite for GCM. Maybe, Users are not logged into their Google account.
The only way to do so is to report back to your server with the timestamp of the received push.
You can either
Report back to the server once you receive the notification in your GCM service. To implement, you will have to add a push id for your push notifications and send the id along with the push data. The client will have to get the timestamp once it receive the message and send it back along with the notification id. A simple php script can be done (when you send a push notification, you set the time of the send-notification and once it receives the device's timestamp it sets the receive-notification. This boils down to two fields in your database (marked in bold). In this approach you will probably not so much care about errors since it is very probable that the device will have a connection when it receives the notification and as such its request to your server will go through.
Keep a list of notifications received in your app and their timestamps. And when the sync is done, send the this data in your sync operation. This is ultimately the same approach but your server's data won't be as realtime as the first approach. However, the extra request is not required from the client's side but saving the received notifications and their timestamps is.
All in all, you will have to keep track of the notifications sent using a notification-id and their sending time (send-notification) and their receive time (receive-notification). A simple query will help you analyze this data.
Google has added support so that you can receive delivery receipts from Cloud Connection Server (CCS):
You can use upstream messaging to get delivery receipts (sent from CCS to your 3rd party app server) when a device confirms that it received a message sent by CCS.
To enable this feature, the message your 3rd-party app server sends to CCS must include a field called "delivery_receipt_requested". When this field is set to true, CCS sends a delivery receipt when a device confirms that it received a particular message.
https://developer.android.com/google/gcm/ccs.html#receipts
Google does not make these statistics available to you. There are some statistics available on the android developer console. This only shows the number of messages and registrations.
You would have to implement your own data collection, which could be done fairly easily. You could record the time & id of each message sent and have your android client report back to your server with the time of message receipt. You could then store the data on your server and query as needed.
Since that time Google has provided developers with advanced monitoring tool.
The Gcm Diagnostic Tool is available in Google Play developer console. Additional information is here https://support.google.com/googleplay/android-developer/answer/2663268
So you can easily track the particular message status via registration token.

Categories

Resources