I\'m sending Firebase notifications through my own webservice with PHP like below.
$url = \'https://fcm.googleapis.com/fcm/send\';
$fields = array(
This problem needs back-end implementation. Let me discuss how I overcome this shortcoming.
We are aware of the Activity life-cycle. So upon destroy, I call a service from the back-end that unregisters my client token. All incoming messages will now be queued for delivery since the token for target client is unregistered.
So upon bringing back the application, I call a back-end service that registers my client. The back end now starts to sends messages from queue with the new client token for my device.