Ionic 6 Capacitor Custom Notification Sound Not working on Android

Viewed 32

I am using Ionic react 6 with capacitor 4 to build an app that requires notifications with custom sound, but its always coming with default sound, I created a push notification channel using this code:

 PushNotifications.createChannel({
        description: 'General Notifications',
        id: 'fcm_default_channel',
        importance: 5,
        lights: true,
        name: 'My notification channel',
        sound: 'jingle.wav',
        vibration: true,
        visibility: 1,
        lightColor: '#FF0000'
    }).then(()=>{
        console.log('push channel created: ');
    }).catch(error =>{
        console.error('push channel error: ', error);
    });

and its getting created successfully, and this the payload I am sending to FCM from sever using php

$fields = [
        "to" => $fcmToken, 
        "notification" => [
              "title" => "New Message", 
              "body" =>  $message, 
              "sound" => "jingle.wav",
              "channelId" => 'fcm_default_channel',
              "notificationCount" => 1,
              "defaultSound"=> false,
           ], 
        "data" => [
                 "type" => "message",
                 "scope" => "user" 
              ] 
     ]; 

and here is my sound file in /res/raw enter image description here

and still can get the sound file to run, its always coming with device default notification sound, I tried real device, emulator, all same problem

thanks

0 Answers
Related