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.