Should we handle InstanceIDListenerService when app is in background?

30 views Asked by At

Should we also handle the case when service is not in foreground? I.e., should we call startForeground (for Oreo) inside the InstanceIDListenerService by ourself? Or it is ensured that the service must be started when app is in foreground only?

To elaborate more, if refreshing token happens while app is in background (killed), then how do I handle it? Should I check if token is refreshed every time app launches?

p.s. I am implementing GCM currently, would switch to FCM early 2019 due to reasons I cannot control.

1

There are 1 answers

0
Derek On BEST ANSWER

In my opinion, we don't have to handle the background case, since it is not mentioned in google's official documentary when implementing GCM.