Laravel-如何更改FCM默认通知调谐



这个问题以前被问过,但被忽略了,如果你有解决方案,那么你的贡献是有价值的,如果我使用下面的代码,有什么方法可以更改FCM通知的默认声音吗;声音"=>quot;到达";到配乐路径不工作?谢谢

public function toFcm($notifiable) {
$message = new FcmMessage();
$notification = [
'body' => trans('lang.notification_your_order', ['parcel_id' => $this->parcel->id, 'order_status' => $this->parcel->parcelStatus->status]),
'image' => Config::get('app.url').'/uploads/parcel.png',
'icon' => Config::get('app.url').'/uploads/parcel.png',
"title" => "Order Updated",   
"content_available" => true,
"priority" => "high",
"sound"=>"arrive",
'id' => 'orders',
];
$data = [
'click_action' => "FLUTTER_NOTIFICATION_CLICK",
'id' => 'orders',
'status' => 'done',
'message' => $notification,
];
$message->content($notification)->data($data)->priority(FcmMessage::PRIORITY_HIGH);
return $message;
}

确保声音的名称与res/raw文件夹中安装的声音的名称匹配,然后确保您的请求是正确格式化的

例如:";filename.mp3";

{
"token": "client_notification_token", <- or topic
"notification": {
"title": "Push notification title",
"body": "Push body",
"sound": "filename", <-- points to src/res/raw/filename.mp3
}
...
}

来源:https://medium.flatstack.com/migrate-to-api-26-push-notifications-with-custom-sound-vibration-light-14846ebc9e96

相关内容

  • 没有找到相关文章

最新更新