Android GCM: duplicate push after notification dismiss -
i sending notification gcm android device , arriving correctly, there 1 case when notifications displaying after being dismissed. steps reproduce:
- open application starts service receive notifications.
- send gcm message
notification
payload. - dismiss notification swiping left/right notification. valid click if has
action_click
element. - open tasks , close current application.
- open application again. when gcm service starts again, receives dismissed notification.
my code basic 1 example provided google using gcmlistenerservice
. set permissions, put services in manifest , let google display notification you. being called twice in onmessagereceive
on service same data when scenario provided happened.
this notification payload sending gcm:
{ collapsekey: 'push', delaywhileidle: true, timetolive: 3600, data: undefined, notification: { body: 'test message 2 updated', title: 'notification', icon: 'myicon' }, contentavailable: false }
edit:
- i using
play-services-gcm:7.8.0
version, tested 7.5 - i can repeat process 5 times, after that, notifications gets dismissed forever.
i struggled problem. new gcm implementation, there no need start service brings information, google starts when needed depending on options of push.
so if have in code lines, remove them:
//this service extends gcmlistenerservice intent intent = new intent(gcmnotificationservice.class, context); context.startservice(intent);
you stop having problems cached notifications, receiving 2 times same notification , weird other behaviour.
Comments
Post a Comment