Android GCM automatically receives push notification

With the new updated GCM document on Android, I follow this guide: https://developers.google.com/cloud-messaging/android/client . It works fine, but I ever get an automatic notification with the packet data being written to onMessageReceived(String from, Bundle data), I got:

Bundle [{breaking_news_payload_extra = CoUGCgJlbhICdWsa +/ OIgAwg2sLczueQgpI7Kg9UZWxlZ3JhcGguY28udWsyiwIaiQEigAFodHRwczovL2VuY3J5cHRlZC10Ym4zLmdzdGF0aWMuY29tL2ltYWdlcz9xPXRibjpBTmQ5R2NTbzdNV2IxYktrU0ZxRjEwN09LT2dKYVhmV0xVNVlZVFJ6YXZod2FwUGd3Qk5rMmZiRmxLaUxCWVU0a203d2w3VmlCYjNUZXJFUChkMGQ4AiJZIlFodHRwOi8vaS50ZWxlZ3JhcGguY28udWsvbXVsdGltZWRpYS9hcmNoaXZlLzAzNDQxL2RhdmlkLWNhbWVyb24tY29yYl8zNDQxN TY0Yi5qcGco7AQwgwMqIkFGUWpDTkVtNXlkSk9IdFRYWUhKWkZsd1hUbThJVUstQ3c4ovjkrwU =, collapse_key = do_not_collapse}]

My usual packet bundle data:

Bundle [{message = message from MyApp, collapse_key = do_not_collapse}]

What's happening?

+4
source share
1 answer

I still cannot understand the problem, but my current solution checks the line fromif it is equal to my google project id. If fromthe google project id is not equal, do nothing.

0
source

Source: https://habr.com/ru/post/1607624/


All Articles