phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

Custom notification sound play very low #2687

Open robertolocal opened 5 years ago

robertolocal commented 5 years ago

Expected Behaviour

Play custom notification sound in normal volume

Actual Behaviour

Plays very low notification sound for a few seconds then assumes normal volume

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 8.1 and 9. Android 8.0 plays normal.

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Motorola Moto G6 and Motorola X4.

Cordova CLI version and cordova platform version

@ionic/app-scripts : 3.2.1
Cordova Platforms  : android 7.1.0
Ionic Framework    : ionic-angular 3.9.2
Plugin version: 2.2.3(latest)

Sample Push Data Payload

{ "data": { 'notId' => 0, 'title' => "Title", 'message' => "Message", "icon" => "ic_notifications", "color" => '#c10100', "sound" => $sound, "android_channel_id" => $sound, "content-available" => "1", "ledColor" => [0, 255, 13, 255], "vibrationPattern" => [500, 500, 500, 500], "priority" => 2, 'foreground' => true, 'coldstart' => true, }, 'to`: $device->getToken(), 'time_to_live': $this - > ttl };

Temporary fix

File: src/android/com/adobe/phonegap/push/PushPlugin.java, line 114 Change this: .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).build(); To this: .setUsage(AudioAttributes.USAGE_MEDIA).build();

ppetree commented 5 years ago

I had this issue back in the 1.8.x days and I used an app (audacity) to punch up the volume on my custom sounds. Unless things have changed, the push plugin has no real control over the volume of the push notifications.

robertolocal commented 5 years ago

I do not suppose he has control. But all other applications are playing at normal volume. This problem appeared when I migrated from version 1.x to 2.x.

ppetree commented 5 years ago

This plugin is, hands down, the worst part of cordova development... every time I have to fool with it, I just cringe because I know it will be like pulling teeth to get it to work.

macdonst commented 5 years ago

@ppetree thanks for your first comment that's a useful workaround to know about. Not so much for your second comment. I'm sorry that you find the plugin lacking. I'm just one guy trying to keep this complicated piece of software afloat.

ppetree commented 5 years ago

You need to work on the documentation. You need to add test features so people can test the custom sounds (and other features) from the phone without a push message... people beat their brains out trying to get this to work. You say it works, FCM says their stuff works, apple and android say their stuff works and us poor devs are left stuck in the middle trying to figure it out. It’s frustrating, time consuming and costly!

My last issue was open for FOURTEEN days without one bit of help and it turns out it’s absolutely a bug in your code!

So please forgive me if I spend 40+ hours following your instructions, tracing code, running countless test cases, hiring shamans and doing everything else under the sun before finally posting a plea for help with logs and other data you require and getting NO help and then not being grateful for the help I didn’t get and complaining publicly about it.

Sent from my iPhone

On Jan 30, 2019, at 7:50 PM, Simon MacDonald notifications@github.com wrote:

@ppetree thanks for your first comment that's a useful workaround to know about. Not so much for your second comment. I'm sorry that you find the plugin lacking. I'm just one guy trying to keep this complicated piece of software afloat.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.