Firebase(FCM) notifications not coming when android app removed from recent tray

后端 未结 3 1471
囚心锁ツ
囚心锁ツ 2021-02-09 02:12

I\'m sending Firebase notifications through my own webservice with PHP like below.

$url = \'https://fcm.googleapis.com/fcm/send\';
        $fields = array(
              


        
3条回答
  •  一生所求
    2021-02-09 03:07

    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.

提交回复
热议问题