Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Register a device on GCM every time the app start is the right approach?

I am developing a phonegap app and followed this tutorial to implement PushPlugin. However, it says to register the app every time deviceready event is triggered. This means that it'll register the device on GCM even if it'd been previously registered.

This made me a little bit uncomfortable as it doesn't seem to be a good practice, since the device was already registered, so, I decided to come here to ask. Is this a good practice? If not, why? Do this have some long term complication?

like image 904
Alexandre Wiechers Vaz Avatar asked Jan 03 '14 18:01

Alexandre Wiechers Vaz


People also ask

What is GCM registration?

A Registration ID is an identifier assigned by GCM to a single instance of a single application installed on an Android device. The device is assigned this identifier when it registers to Google Cloud Messaging.

What is GCM service on Android?

Google Cloud Messaging (GCM) is a service that allows you to send push notifications from your server to your users' Android devices, and also to receive messages from devices on the same connection.

How do I enable GCM?

Open your app's settings and select Intercom for Android. Then find the "Enable GCM" section.


1 Answers

In our application we have found this to be a good practice for several reasons:

  1. The API for registering the device returns a token that represents that device. From what I could see, GCM does not guarantee that the token will remain valid indefinitely. Thus failure to register could lead to expiration of your device token.

  2. Registering with GCM, makes the service aware that your device is active. From what we observed, devices recently registered with GCM seemed to receive push notifications fastest. That is, given 2 devices, one recently registered (Device A), and the other that had last registered several days ago (Device B), Device A would always receive push notifications faster - often minutes before Device B. This is simply what we observed.

like image 96
EJK Avatar answered Oct 05 '22 23:10

EJK