vendredi 3 décembre 2021

custom sound doesn't work using fcm in flutter

I am working with laravel as a server and flutter as a frontend, I am using fcm, I get the notifications but with the default android sound and I cannot make them custom. in flutter I create a file in main / res / raw / notification.wav and This is my code in laravel

public function toFcm($notifiable)
    {
        $message = new FcmMessage();
        $notification = [
            'title'        => "Nueva Orden #".$this->order->id." para ".$this->order->restaurant->name,
            'body'         => $this->order->user->name,
            'icon'         => $this->order->foodOrders[0]->food->restaurant->getFirstMediaUrl('image', 'thumb'),
            'sound'        => "notification",
            'click_action' => "FLUTTER_NOTIFICATION_CLICK",
            'id' => '1',
            'status' => 'done',
        ];
        $message->content($notification)->data($notification)->priority(FcmMessage::PRIORITY_HIGH);

        return $message;
    }


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire