Ionic push notifications custom sound are not playing on Android Oreo and above versions

As per Ionic documentation of push plugin, I created Channel for android O and above version. Refer link:-

https://ionicframework.com/docs/native/push/

I actually wanna play custom sound when push notification received and its already working on Android 7(Nougat) and below versions, but I am getting issues on Android Oreo and above versions, push notifications are receiving, but not custom sounds are not playing. I refer lots of links to resolve this issue, but its nothing to work.

Refer links:-

https://github.com/phonegap/phonegap-plugin-push/issues/2017

https://github.com/phonegap/phonegap-plugin-push/issues/2446

In mostly suggested solutions they suggested to add “sound” parameter in createChannel method like this:-

this.push.createChannel({
id: "testchannel7",
description: "asdf",
sound: 'pulse',
// The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest.
importance: 4,
vibration: true
}).then(() => console.log('Channel created'));

But I am getting

Typescript error :- Typescript Error Argument of type ‘{ id: string; description: string; importance: 3; sound: string; }’ is not assignable to parameter of type ‘Channel’. Object literal may only specify known properties, and ‘sound’ does not exist in type ‘Channel’.

Even I stored my sound.mp3 files in following position:- platforms/android/app/src/main/res/raw

In my payload sound parameter is already added without extension such as :-

{
...,
...,
sound: soundname,
...
}

My ionic environment configuration:-

Ionic:

ionic (Ionic CLI) : 4.5.0 (/usr/local/lib/node_modules/ionic)

Ionic Framework : ionic-angular 3.9.2

@ionic/app-scripts : 3.1.6

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)

Cordova Platforms : android 7.1.4

Cordova Plugins : cordova-plugin-ionic-webview 3.1.1

Push Plugin Version:-

phonegap-plugin-push 2.2.3 “PushPlugin”

Please help me to solve this issue, Thanks in advance.

1 Like