Question

I need to work on android mobile push notification. I have recently gone through some of the tutorial on google. I would like to summarize the my understanding first

  1. Developer registers the app with play store and get some unique code called Application_Id
  2. Once the end user downloads the application from store and login(or register) the application, his/her device_id is sent to to GCM(google cloud messaging service(hosted on google cloud) and GCM generate the unique token for that device and sent back to app on device.
  3. App on device send back that token to back end app server which keep the device_token_gcm along with user details
  4. Now whenever back end need to send the notification to mobile user, first it will send to GCM along with device_token_gcm which GCM will forwards to mobile user.

Is that correct ?

Question :-

  1. What if user is offline, will GCM keep it with itself somewhere in queue ?
  2. I believe GCM keeps the device_id with itself and generate the unique token which is sent to back end app server. So back end application has unique token not device_id ?
Était-ce utile?

La solution

I am going to assume you mean FCM, considering GCM has been deprecated.

What if user is offline, will GCM keep it with itself somewhere in queue ?

Yes, even when the device is offline at the time of invoking the notification from your server, it will be dispatched to FCM service and FCM will try to notify the device once it comes online. The default TTL of an FCM message is 4 weeks, i.e. if your device fails to come online within 4 weeks, the message is discarded.

You can also specify your own TTL settings, in which case the expiration might be shorter.

I believe GCM keeps the device_id with itself and generate the unique token which is sent to back end app server. So back end application has unique token not device_id ?

Yes, your backend knows nothing about the actual notification token, it has a device token generated by the FCM service which it uses to call FCM's API to invoke a push notification.

Licencié sous: CC-BY-SA avec attribution
scroll top