Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by TedBom · May 21, 2018 at 07:58 AM · unity3dPush Notifications

Unity RemoteNotification userData empty where I expect CustomData

Hello,

Currently we are trying to implement Remote Push Notifications through CloudScript.

We are executing the following CloudScript function extending the basics article:

var testObject =
  {
  	"TestKey" : "TestValue"  
  };
  
  var jsonString = JSON.stringify(testObject);
    
  try {
    server.SendPushNotification({
      Recipient : currentPlayerId,
      Package : {
        Message : "Test challenges you for a battle!",
        Title: "You have been challenged",
        CustomData : jsonString
      },
    });
  } catch (ex) {
    // Target player has not registered for Push Notifications
  }

On Android we properly receive the CustomData in the MessageReceivedEventArgs.Message.Data field.

However on iOS with Unity's built-in RemoteNotification I can't seem to find the Custom Data anywhere. The alertBody is present, but the userData Hashtable is empty.

Are we missing something or are we suppose to use a custom plug-in/native implementation?

Are we perhaps suppose to use AdvancedPlatformDelivery instead of Package to get custom data to iOS users?

Cheers,

Ted

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by comc · May 22, 2018 at 08:41 PM

Yes, you can use AdvancedPlatformDelivery if you know the structure of the JSON you should be receiving from the device. We have added a work task to support it properly.

Comment
TedBom

People who like this

1 Show 1 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TedBom · May 23, 2018 at 05:14 AM 0
Share

Thank you for the reply,

I have tried AdvancedPlatformDelivery, however it seems that for iOS it wraps the AdvancedPushPlatformMsg.Json value in the aps dictionary. Meaning that I can only supply it with valid aps keys as documented here:

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html#//apple_ref/doc/uid/TP40008194-CH17-SW1

If I read the documentation correctly to supply additional data, I would have to add data in addition to the "aps" dictionary. This is an example from Apple's documentation.

{
    "aps" : {
        "content-available" : 1
    },
    "acme1" : "bar",
    "acme2" : 42
}

Of course I can try to write my own native solution to parse the data manually, but if possible I would like to avoid that. Would it be possible to get a confirmation for if that is how the AdvancedPlatformDelivery currently works for iOS?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    1 Person is following this question.

    avatar image

    Related Questions

    FCM ios push notifications aren't working (android does) for Unity 4 Answers

    Push Notifications On Unity with Firebase 1 Answer

    Push notification scheduling not working? 3 Answers

    Scheduled notifications - How to call 1 Answer

    Is it possible to store the content of a push notification in title player account? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges