question

RedRain Team avatar image
RedRain Team asked

PlayFab Push Notification Question

Hello, my studio been using this amazing Backend Services for a while ! Recently i been trying to play around with Push Notification and Cloud Script, things are perfect and easy to use. However i am stuck when trying to do some stuff according to the Push Notification and Cloud Script:


  1. Can i send a PushNotification without Alert /PopUp Notification ? So what i am trying to do is, when i added a friend, my in game friend will receive the PushNotification. Since the PushNotification can be received while you in the game, my friend will get an In-Game popup that i added him/her directly, but i dont want the notification popup when he / she is off the game. Because, imagine if 10 people added you and you get 10 notification popups !

    This won't be only for Friend System, i imagine, for example, a Raid Invitation. If the game have to give an Popup Notification for a Raid Invitation, the phone will be rained with those Popups. So is there anyway to Send a PushNotification that wont popup any notification on the Phone ?
  2. I Tried to push several PushNotifications to the Phone, for example i push a:

    Raid Time Notification, Friend Request Notification, Daily Login Notification. The Notification stack up just like a new notification instead of group / replace them. Imagine if the player is off for a few days and the game sent 4 Notification a day, the player might have 12 Popup notification just in 3 days x). is there anyway to either "replace" the notification ? or at least "replace" the very same notification instead of making a new popup every time ?

Note: Everything is on Android, i hope someone can help me with this ! Thank you

Push Notifications
10 |1200

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

JayZuo avatar image
JayZuo answered

According to your description, what you need seems to be the "Data message". Client app is responsible for processing data messages and there will be no system tray for Data message. For more details, please see Message types and Handling messages. PlayFab supports Data only message with AdvancedPushPlatformMsg. For example:

{
    "Recipient": "{
                {PlayFabId}}",
    "AdvancedPlatformDelivery": [
        {
            "Platform": "GoogleCloudMessaging",
            "Json": "{\"Nick\":\"Mario\",\"body\":\"great match!\",\"Room\":\"PortugalVSDenmark\"}",
            "GCMDataOnly": true
        }
    ],
    "TargetPlatforms": [
        "GoogleCloudMessaging"
    ]
}

Please note, there is no need to add "data" key in the Json string.

Currently, PlayFab only supports "Payload" part of Firebase Cloud Messaging HTTP protocol. While "GCMDataOnly" is set to false, which is the default value, we will put your Json into both "data" and "notification". Other keys are not supported. Thus, "collapse_key" can't work with PlayFab Push Notification.

If you do needs this or have any suggestions about PlayFab Push Notification, please feel free to post a feature request.

2 comments
10 |1200

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

RedRain Team avatar image RedRain Team commented ·

This, so far seems what i am looking for, i will try these and get back ! Thank you for the answer so far :)

0 Likes 0 ·
RedRain Team avatar image RedRain Team commented ·

This works like a charm, thank you @Jay Zuo

0 Likes 0 ·
Rick Chen avatar image
Rick Chen answered

There are no configurations in PlayFab to switch on/off the Alert/Pop up or “replace” notifications. Please refer to this document: https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream-http-messages-json and add some options to Android Payload that may suit your needs. For example, “collapse_key” is intended to avoid sending too many of the same messages when the device comes back online or becomes active.

1 comment
10 |1200

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

RedRain Team avatar image RedRain Team commented ·

Dang, so far this will "solve" the answer to my 2nd question, but i still need the answer for the 1st Question, i reckon that's no way for me to turn off the popup. But then, how to solve the 1st Question ? is there any way to "notify" the other player without using push notification in real time ?

Also, i did read the firebase docs you link above, but how to implement those with Playfab?

Thank you !

0 Likes 0 ·

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.