Fickle push notifications: Emulator VS Device

326 views
Skip to first unread message

Simone Me

unread,
Aug 27, 2019, 11:05:26 PM8/27/19
to Firebase Google Group

I have a problem with push notifications, which behave differently on my emulator compared to my Android device: on the emulator these work. On my device no!

When I send notifications with my code, with the respective tokens, the payload is identical, and in both cases the FCM response is positive:
{"multicast_id" 5447281274726630302, "success": 1, "failure": 0, "canonical_ids": 0, "results": [{ "message_id": "0: 1566 ..."}]}

The emulator in question is BlueStacks, on wich I installed the APK.
The device is instead a Mediacom PhonePad Duo with Android 6, and on this I installed the APK by copying it to the device, and enabling the execution of unknown source applications.
On the device, all notification settings for my application are active.

This is my payload:
{"time_to_live"": 86400,
"date":{
"body": "We have released a new film",
"title": "New movie",
"custom1", "custom123"
"custom2", "custom456"
"time": "08/27/2019 23:33:31",
"content-available": "1"
},
"registration_ids": [ "my-token"]
}

Personally, I have two hypotheses regarding this problem:

1) the problem depends on the fact that the application has an unknown source. Maybe Android blocks notifications to unknown source applications!?!
I don't have a Google Play developer account yet, so I can't verify this, and I haven't found any information about this theme.

2) Maybe the payload is malformed? This works very well both on the FCM Web application (Desktop Notifications on Chrome), and on the Android application (on the emulator). 
And if this were true, notifications would not work on the emulator... (unless BlueStacks behaves like Chrome)

I must also specify that I have sent a notification to the two (emulator and device) at the same time, using the "Cloud Messaging" function on console.firebase.google.com to send "test messages".
The report shows 2 messages sent. But again: the emulator showed the notification, but my device didn't.

Any idea?
Thanks in advance.

Kato Richardson

unread,
Aug 28, 2019, 5:23:20 PM8/28/19
to Firebase Google Group
I think the first thing to check is that the reg token on your actual device matches your expectation. Maybe just request a new one to be sure, and subscribe that to any topics needed to receive the notification.

Side note: I presume your payload description above has a typo and you aren't actually sending "date" instead of "data".

☼, Kato 

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/10d052ec-6009-474e-aa88-968d055f6379%40googlegroups.com.


--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Reply all
Reply to author
Forward
0 new messages