I recently tried out the reengineered Playfab Push Plugin for Android. It works as promised but I had pain in my stomach due to its requirements (that means, having to restrict my project to Android SDK=19 or higher, which means loosing 27% of the Android market, and using some dangerous permissions that disturb new users who have to grant something before playing). So I had a look around and found the Firebase Messaging Plugin for Unity. That Plugin also handles push notifications but doesn't have the aforementioned disadvantages (it has minSDK=16, and no dangerous permissions). I'd like to use it together with Playfab, but I can't get it to receive push notifications that were send via Playfab.
Or more specific: It does receive the push messages from Playfab when being in-game, but nothing appears on the notification tray when the app is in the background, or not running.
What I receive in-game is a message that is defined by this JSON:
{ "to" : "devicePushToken", "data" : { "default" : "here I find the text that I have delivered to the Message-Property of Playfab.Server.SendPushNotification" } }
I suspect that the reason why I don't get a notification to the notification tray when the app is in the background, is that this JSON is actually (according to the Firebase doc) not a "notification message", but a "data message". It would probably work if I just add another key named "notification", on the hierarchy layer of the "data" key. Like this:
{ "to" :"devicePushToken", "data" : { "default" : "..." }, "notification": { "body" : "text for the notification tray" } }
or replace the "data" key all over, like this:
{ "to" : "devicePushToken", "notification" : { "body" : "text for the notification tray" } }
But I didn't find a way to change the JSON-content. I seem to have only access to the "default" key inside the "data" key. Is there a way or at least a workaround to define the content of the JSON? That would be a big relief.