Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push notification, sound vs soundname #534

Closed
nomaam opened this issue Dec 29, 2020 · 3 comments
Closed

Push notification, sound vs soundname #534

nomaam opened this issue Dec 29, 2020 · 3 comments

Comments

@nomaam
Copy link

nomaam commented Dec 29, 2020

does not play a sound, will not play default sound either

        $data = [
            'title' => $title,
            'body' => $body,
            'sound' => "mysound"
        ];

        $message = CloudMessage::withTarget('token', $deviceToken)
            ->withData($data);

does play a sound

        $data = [
            'title' => $title,
            'body' => $body,
            'soundname' => "mysound"
        ];

        $message = CloudMessage::withTarget('token', $deviceToken)
            ->withData($data);

Three days of troubleshooting to figure out how to play a sound.

Hopefully this saves someone else the headache...

@jeromegamez
Copy link
Member

Thank you for the information! Is this related to iOS, Android, WebPush notifications, or even all of them?

Sounds are somehow a recurring issue - have you tried using https://firebase-php.readthedocs.io/en/5.14.0/cloud-messaging.html#notification-sounds to see if that helps?

I haven't seen the soundname field before, could you show me some official documentation where it is described? This SDK currently only works with what I know from https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages and https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html

@nomaam
Copy link
Author

nomaam commented Dec 30, 2020

Yes I have tried using

https://firebase-php.readthedocs.io/en/5.14.0/cloud-messaging.html#notification-sounds

But I could only get default sounds working, and then my other settings would stop working.

I am working on Android through Cordova. Here is the documentation that mentions soundname. I have older apps that still use sound, not soundname, but I guess there was an update somewhere that changed it to soundname

https://github.com/havesource/cordova-plugin-push/blob/master/docs/PAYLOAD.md#sound

@jeromegamez
Copy link
Member

After some research I have the strong feeling that soundname is something Cordova-specific or at least client-side-framework-specific - the only places where I could find soundname instead of sound was in the Cordova-Plugin you linked to and zo0r/react-native-push-notification#1432... nowhere else.

I tried adding it somewhere in the AndroidConfig (similarly to what I shared in #533 (comment)), but this was rejected by the FCM APIs.

Long story short: thank you for sharing your findings, hopefully others will stumble upon this thread when they face similar issues - unfortunately there's little that can reliably be done on the SDK side :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants