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.
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.