3

I am about to implement GCM in my application, but I am unable to find the answers of the follow questions in the documentation :

My app requires time critical delivery of the changes in the server.

  • Will be the GCM deliver the notifications immediately ( no delay ) even when the device is sleeping ?

    • Will notification wake the device immediately ?
  • There will be about 2-3, up to 20 notifications per second, will this cause an issue ?

  • Will be there any cost of the service with these requirements ?

Yordan Yanakiev
  • 2,546
  • 3
  • 39
  • 88
  • [I'm not expert on the current technology, but ...] Key question is how many notifications are you expecting **per day**? If the answer is "more than 100" or maybe these days "more than 1000", consider only using an occasional high priority push message to wake the app, then have it ask your server for all updates after the time it last received updates, and have your server package all that information into a single packet of some type. That is, you might be trying to do something for which push notification is not effective; don't do it all through push. And look into Firebase FCM for push. – ToolmakerSteve Feb 08 '17 at 23:45
  • ... Specifically, given that many notifications, I assume you are discussing sending **data** to the phone - these aren't notifications that the user needs to see (because that would be an overwhelming number). – ToolmakerSteve Feb 08 '17 at 23:49

2 Answers2

3

Will be the GCM deliver the notifications immediately ( no delay ) even when the device is sleeping ?

Yes, You can set the priority of a message as a High priority.

GCM attempts to deliver high priority messages immediately, allowing the GCM service to wake a sleeping device when possible and open a network connection to your app server. Apps with instant messaging, chat, or voice call alerts, for example, generally need to open a network connection and make sure GCM delivers the message to the device without delay. Set high priority only if the message is time-critical and requires the user’s immediate interaction, and beware that setting your messages to high priority contributes more to battery drain compared to normal priority messages.

Will notification wake the device immediately ?

It is been answered in the description above :)

There will be about 2-3, up to 20 notifications per second, will this cause an issue ?

I think this SO questions can help you with that question.

Will be there any cost of the service with these requirements ?

From Google Cloud Messaging: Overview

Google Cloud Messaging (GCM) is a free service that enables developers to send messages between servers and client apps. This includes downstream messages from servers to client apps, and upstream messages from client apps to servers.

Just take NOTE that Firebase Cloud Messaging (FCM) is the new version of GCM. It inherits the reliable and scalable GCM infrastructure, plus new features! If you are integrating messaging in a new app, start with FCM. GCM users are strongly recommended to upgrade to FCM, in order to benefit from new FCM features today and in the future.

Community
  • 1
  • 1
KENdi
  • 7,576
  • 2
  • 16
  • 31
  • "wake a sleeping device when possible" .. "when possible" - this is the part which is completely unclear. Please explain it. About the second question - it is count per second toward 1 device. – Yordan Yanakiev Jun 15 '16 at 16:29
  • The price list is for Firebase or FCM not GCM, – KENdi Jun 20 '16 at 04:34
  • 1
    @YordanYanakiev - Re "when possible", I would not rely on push notifications as the **only** way to inform a device about server updates. If this is critical update info for app, then whenever your app awakes, either from a push message, or from user action, *have the app ask your server* for any changes since the time it last asked (via whatever query method you are using, something that app initiates, not push). IIRC, even Apple says to do that. Not a good idea to assume that 100% of push messages are received by the app, under all conditions. – ToolmakerSteve Feb 08 '17 at 23:58
0

Actually, GCM is not recommended at all for time-critical operations, due to its reliability issues [1] [2] [3]. Notifications may be delayed, rate-limited, lost in transit, or arrive in a different order than which they were sent.

There are alternative push notification gateways you could use instead, which are far more reliable for your time-critical operational needs.

Pushy (https://pushy.me/) offers a highly-reliable push notification gateway for Android apps that works independently from GCM, using its own background MQTT connection.

Full disclosure: I founded Pushy.

Community
  • 1
  • 1
Elad Nava
  • 7,746
  • 2
  • 41
  • 61