kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
1.05k stars 169 forks source link

notification sends correctly to google phone, but doesn't send to samsung, xiaomi phone #81

Closed topninja closed 3 years ago

topninja commented 3 years ago
use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\Notification;

protected function sendNotification($deviceToken, $title, $body, $data){
        try {
            $messaging = app('firebase.messaging');
            $message = CloudMessage::withTarget('token', $deviceToken)
                ->withNotification(Notification::create($title, $body))
                ->withData($data);
            $messaging->send($message);
            return true;
        } catch (\Throwable $th) {
            return $th->getMessage();
        }
    }

my codes are here. working well on google phone but not working in Samsung, xiaomi phone plz help thanks

jeromegamez commented 3 years ago

If sending the messages work (no exception is thrown) and the message arrives on one phone, but not the others, the message itself must be correct, and Firebase has accepted it.

Unfortunately, I can't tell why the message doesn't arrive on the Samung and Xiaomi phone - it could be a delivery issue on Firebase's side, this you could check by opening a support request, or a reception issue on the devices. I'm sorry that I can't help further here, please feel free to add comments with your findings if you manage to resolve the issue, or just to share your progress! 🤞🏼

topninja commented 3 years ago

Yes, I will try