Open EtienneLem opened 4 years ago
Strange, I was just about to raise an issue that I don't get any notification sound if I don't use the notification node? That was on my Oppo Reno Z but think it happened on a Samsung too
I can confirm the same behavior on a Samsung Galaxy S10+ as well.
Notification sounds are being treated as a "Ringtone".
Other really annoying side effects from this are that the notification audio plays through speaker, even if headphones are in, and it plays over other playing media without pausing it.
The issue still remains unsolved. I tested it on a galaxy a54.
What I do to workaround is to search for USAGE_NOTIFICATION_RINGTONE
in plugin's android native code, and then replace it with USAGE_NOTIFICATION
. It works in plugin v2.0.0 (java) but I think in v4.0.0 (kotlin) the workaround is similar.
Specifically, in v2.0.0 PushPlugin.java:
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
- .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).build();
+ .setUsage(AudioAttributes.USAGE_NOTIFICATION).build();
Bug Report
Notifications sound volume seems to be unexpectedly controlled by the “Ringtone” settings:
The sound played is the system’s notification sound, not the ringtone one. We’re receiving reports of users being woken up in the middle of the night because of our notifications. That might be an issue on Samsung devices only. On a Pixel device the notification volume seems to be controlled by “Ring” volume:
This (https://github.com/missive/cordova-plugin-push/commit/5b80995a9d83b22ad461d59ba7a1ff24f729b68b) was our naive attempt at fixing this based on this documentation (https://developer.android.com/reference/android/media/AudioAttributes), but it did not have any effect.
Reproduce Scenario (including but not limited to)
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
• Android 9 • Android 10
(Android) Device Vendor (e.g. Samsung, HTC, Sony...)
Samsung devices only as far as we can tell • Galaxy S9+ • Galaxy S8+ • Note 9
Sample Push Data Payload
Sample Code that illustrates the problem
Our plugin init looks like this: