Closed mohamedhussieen closed 2 years ago
If the SDK doesn't report any errors and your method returns successfully (= no exception has been thrown), it means that Firebase has received the message, so the work of the PHP SDK is done, and there's nothing it can do going further.
I don't know what "Firebase sender test" is, but it has been often reported by users that sending messages is delayed or doesn't work at all. If the message doesn't arrive at its destination even with a delay, please open an issue directly with Firebase.
PS: In the future, please create just one issue, and give it a short descriptive title like "FCM messages don't arrive at target". Please also care for the formatting of the issue description to make it easier to read - GitHub provides Markdown tools for that.
public function sendNotificationToDevices($textMessage, $data, $token) { try { $messaging = app('firebase.messaging'); $message = CloudMessage::withTarget('token', $token) ->withNotification(Notification::create($data, $textMessage)) ->withData($data); $messaging->send($message); return true; } catch (\Throwable $th) { return $th->getMessage(); } }