question

contact-1 avatar image
contact-1 asked

Push notifications no sound

We are dicovering that on iPhone we don't get any sound with the push notifications. Is there option to play default sound? Also we have different platforms users and we are not able to push with specific sounds since if it plays on Android - on iPhone it will show json in message - and it's not what we want.

10 |1200

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

brendan avatar image
brendan answered

Currently, we provide advanced Push features for Android via our plugin (https://api.playfab.com/docs/push-for-android), but not for iOS. We'll be adding a plugin for advanced Push on iOS as soon as we can, but I'm afraid we don't have a scheduled date for that yet.

4 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.

contact-1 avatar image contact-1 commented ·

And why there is no sound on iOS even if we use default settings? It used play previously and suddenly muted.

0 Likes 0 ·
brendan avatar image brendan contact-1 commented ·

We actually haven't changed anything on the iOS side - we use AWS SNS to communicate with APNS (and the sandbox version), which passes the message on to the device. Since we don't provide a plugin to evaluate parameters like custom sounds, etc., any change to sounds being played would likely be local to the device.

0 Likes 0 ·
info-9 avatar image info-9 brendan commented ·

I'm experiencing the same thing on iOS: The push notification arrives, but doesn't play a sound. I checked in the device-settings that the app has permissions to play sound on notification arrival and the device sound volume is turned on, and the sound does play when notifications from other apps arrive.

Are you sure that the JSON payload that you construct and send to Amazon SNS does contain the key

"sound":"default"

?

0 Likes 0 ·
Show more comments
info-9 avatar image
info-9 answered

First: sorry, I'm not very skilled in using this forum. @Brendan I think I just downvoted your reply accidentally because I didn't know the meaning of the symbol. Moreover I didnt find the reply-button at your answer so I hope this post will anyway be appended to your answer.

Now back to the question: When I wrote my comment I had Plafab Unity SDK 170530 installed. Now I upgraded to SDK 170612, but nothing changed, stil no sound. You are talking about „Package“, where you can pass in the value for the sound parameter. Thats interesting. Do you mean that „Package“ is an additional property of the SendPushNotification function besides „Recipient“, „Message“ and „Subject“? I had a look in the server code in the Unity SDK 170612, but couldn't find it (i only found „Recipient“, „Message“ and „Subject“).

I tried to send the notifaction with the „Try it“ button in the API Reference and from code, but the result is the same.

This is the code I use:

ExecuteCloudScriptRequest executeCloudScriptRequest = new ExecuteCloudScriptRequest
{
    FunctionName = "SendPushNote",
    FunctionParameter = new
    {
        Id = "683173999F249BEF",
        Msg = "push test text"
    }
};
PlayFabClientAPI.ExecuteCloudScript(executeCloudScriptRequest, CallbackSuccess, CallbackError);

And the called cloudscript is this:

handlers.SendPushNote = function (args)
{
    var request = {};
    request.Recipient = args.Id;
    request.Message = args.Msg;
    server.SendPushNotification(request);
}
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.

brendan avatar image brendan commented ·

No worries - I'm pretty sure my reputation score can take the hit. :)

This reply is too large to be a Comment in our current configuration, but that's never a problem - we can just continue the discussion in this sub-thread.

Don't worry about the Package for now - from talking with my tools team, it sounds like that's not exposed yet, so it couldn't be the cause of this. Unfortunately, that means there's no immediately apparent reason you would be getting different results from others, when the code is, as you've shown, quite straightforward. I'm going to have the tools folks who work most closely with Push Notifications have a look at this, and see if they can make any recommendations.

0 Likes 0 ·
info-9 avatar image
info-9 answered

I have an assumption for the reason. Because when I send a push notification from within the Playfab Game Manager>Players>Select Player>SendPushNotification-Button, then there is another strange behaviour: The push notification arrives at my phone (still without sound), but on my receiving phone it it doesnt display the text, that I delivered in message-field, but instead displays that:

{"ScheduleDate":"2017-06-18T12:32:52Z","Title":"test title that I wrote in the title field","Message":"text that I wrote to the message field","Icon":"","Sound":"","CustomData":""}

So it seems that for some reason it doesnt show the message, but the json payload. Thats not a big problem, since this only happens when sending from the game manager, and works correct when sending from code. But the interesting thing is that this json payload shows

"Sound":""

while the apple docs require to fill this field with

"sound":"default"

if a sound should be played. Though the apple docs say, that it falls back to the default sound, when the specified sound file is not found, but maybe they treat an empty string differently.

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.