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:

  1. open application starts service receive notifications.
  2. send gcm message notification payload.
  3. dismiss notification swiping left/right notification. valid click if has action_click element.
  4. open tasks , close current application.
  5. 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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -