php-firebase-cloud-messaging
php-firebase-cloud-messaging copied to clipboard
Android sound Android O+
For android 26+ setting sound doesn't work anymore. We need to create a channel on android.
So, this code not gonna work on newer versions of android.
$notification->setSound('police.wav');
this will
$notification->setSound('police.wav'); //old versions of android and ios $notification->setJsonKey('android_channel_id', 'noti_push_app_1'); //new android
Maybe, we could have something like
$notification->setSound('police.wav', 'noti_push_app_1' /*this part not been required*/);
or
$notification->setChannelId('noti_push_app_1');
@steks89 thanks for the new version. I can receive the notification with my channel id but i don't have the sound. I think that the device can not find the audio file. What is your plugin.xml config ?
Plugin.xml resource-file src="res/raw/custom.wav" target="app/src/main/res/raw/custom.wav"