question

Koen avatar image
Koen asked

Platform specific custom formatted Push Notifications

Hi Playfab,

We're currently developing an async multiplayer game using Playfab. We want to send custom formatted push notifications to our users (user to user) so we can open that specific game when the user taps the notification.

It's possible to format the necessary JSON for a specific platform ourselves (Android and iOS currently). Except we - as far as we know - have no way to send the correct JSON to the user since we don't know if they're registered with iOS and/or Android. Is it possible to send 'generic' custom push notification data so that Playfab formats the correct JSON for the stored notification token's platform?

We could store an "iOS" or "Android" string in the user's public data when a token is registered so we know how to format the JSON. The problem is that this fails if a user is registered with multiple platforms.

How can we fix this problem?

Kind regards,

Koen.

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.

1 Answer

·
brendan avatar image
brendan answered

Not currently, I'm afraid. As stated in the Server/SendPushNotification documentation, if a user has registered for Push on both iOS and Android, the same message would be sent to both. We do currently provide a plugin for Unity developers that allows them to use advanced Push on Android devices, but we don't yet provide a way to send a Push Notification only to one platform device type. I've added a backlog item for that, so that we get that added in future. For now, I would recommend something similar to what you suggest - set the "iOS" and "Android" values when the user registers for Push, and use your specific advanced Push format for each if only one of those values is set. You could then either send a more generic, non-advanced Push message if they have both set, or else check those values when the user goes to register Push and not allow it (or give them the option to choose) if they try to turn on one when they have the other set.

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.

Koen avatar image Koen commented ·

@Brendan We've implemented your suggestion and it works great. Thanks.

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.