[英]How to make notification work with sound this not working with sound or even default notification sound in android
如何使通知在此 Php laravel 项目中与声音一起工作 这在 android 中无法使用声音甚至默认通知声音
public function toFcm($notifiable)
{
$message = new FcmMessage();
$notification = [
'title' => "New Order #".$this->order->id." to ".$this->order->foodOrders[0]->food->restaurant->name,
'body' => $this->order->user->name,
'icon' => $this->order->foodOrders[0]->food->restaurant->getFirstMediaUrl('image', 'thumb'),
'click_action' => "FLUTTER_NOTIFICATION_CLICK",
'id' => '1',
'status' => 'done',
];
$message->content($notification)->data($notification)->priority(FcmMessage::PRIORITY_HIGH);
return $message;
}
尝试使用 setAndroid 方法:
$message->content($notification)->data($notification)->priority(FcmMessage::PRIORITY_HIGH) ->setAndroid(
AndroidConfig::create()
->setNotification(AndroidNotification::create()
->setNotificationPriority(NotificationPriority::PRIORITY_DEFAULT())
->setDefaultSound(true)
));
方法setDefaultSound(true)
告诉 android 运行默认声音。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.