Android GCM: duplicate push after notification dismiss

后端 未结 1 373
我寻月下人不归
我寻月下人不归 2021-01-27 05:03

I am sending a notification with GCM to an Android device and it is arriving correctly, but there is one case when the notifications are displaying after being dismissed. The st

相关标签:
1条回答
  • 2021-01-27 05:38

    I finally struggled the problem. With the new GCM implementation, there is no need to start the service that brings the information, is Google who starts it just when it is needed depending on the options of the push.

    So if you have in your code something this lines, remove them:

    //This service extends GcmListenerService
    Intent intent = new Intent(GCMNotificationService.class, context);
    context.startService(intent);
    

    You will stop having problems with cached notifications, receiving two times the same notification and some weird other behaviour.

    0 讨论(0)
提交回复
热议问题