Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

Controlling sound for `createLocalNotification` #74

Closed Return-1 closed 5 years ago

Return-1 commented 5 years ago

This is not so much of a direct issue ( albeit it does render the feature unusable in what i imagine is most cases like mine). Creating a local notification yields no sound at all and there seems to be no way to enable that even if setSound is used. Do you have any workaround on this? The reason is the following:

Implementing scheduled notifications functionality could be needed and since someone might already be using this lib, it would be ideal to use the same provider to that end. The only other solution is using react-native-push-notification which is very hard on the Android manifest.

To my knowledge, there seems to be no library simply for local and scheduled push notifications for react native and yours would have been a great candidate for that. However a scheduled notification reminder is not much good if its silent in nature as its easily missable. A default of sound enabled with no option to control it would have been a lot better i believe.

P.S: The method also seems to not be documented on the Docs but i can verify that it works.

wfhm commented 5 years ago

@Return-1,

I have checked it and, when a local notification is shown on Android, a default notification sound was played, so I could not reproduce the issue so far. Could you please elaborate on this issue? Are regular push notifications received with a sound on your Android devices? Which particular device models and OS versions were you testing it on?

Return-1 commented 5 years ago

@wfhm it turns out that on Xiaomi devices you need to include the following

<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>

otherwise the only way to have sound in notifications is to go through settings and enable them manually.

I highly suggest adding this to the documentation as Xiaomi devices are quite common and it would be great to give people a heads up now that we know how to fix this : )

wfhm commented 5 years ago

@Return-1,

Wow, thank you for sharing your research! We will definitely add it to our documentation.