Should I make the call each time a user enters the main activity or should I only make it when the user first installs the app?
startService(new Intent(this, RegistrationIntentService.class))
Should I make the call each time a user enters the main activity or should I only make it when the user first installs the app?
startService(new Intent(this, RegistrationIntentService.class))
Essentially the RegistartionIntentService will do the same action (register your app to google's SNS server using the token your app acquired) so it's pretty much usless to do it every time, I'd say you should do it only once after the first time the app has opened.
In order to send push notifications to a device, you need the registration token that is generated by your app when you run your registration service. What you do with that token after you register the device is up to you.
What I do is, when my user logs into my app, I run my GCM registration service which for me, generates a token and then sends that token (along with the logged in user information) to my backend database. From that point forward, my backend code knows the user has registered their device and whenever I need to send them a push, I know to send it with that token.
When the user logs out, I once again make an API call to my backend database which deletes the GCM registration token (you don't have to but its how I do it.)
The point is, once you get that token with your registration service, what you do with it is your responsibility. Save it, store it, etc. You only need to get it once - then you can send all the pushes you want.