question

info-9 avatar image
info-9 asked

Can I send push notifications from Playfab to the Unity Firebase Plugin (Android)?

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.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
1807605288 avatar image
1807605288 answered

We use Amazon SNS: http://docs.aws.amazon.com/sns/latest/dg/SNSMobilePush.html

Because of this, we don't have full control of the communication between Amazon SNS and the device. And we don't currently have plans to investigate this piece of our system.

API 19 vs 21: I discuss that here, in a response to another customer asking the same question.

Permissions: I recently took over this plugin from another PlayFab employee, so there were (and continue to be) some aspects that I wasn't fully familiar with. I agree, this list of permissions seems excessive, and I'm not sure why they are all here. I can't make promises about fixing these, but I will try to investigate why.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.