Closed robertnicjoo closed 2 years ago
CloudMessage::withTarget('token', 'rtc')
Make sure that you use a valid registration token where you currently have rtc
CloudMessage::withTarget('token', 'rtc')
Make sure that you use a valid registration token where you currently have
rtc
Thank you, can I have both token and topic at the same time?
For anyone else stumbling upon this: It's not possible to send a message to a token and a topic simultaneously, so you'll need two messages to achieve this, for example with:
$messaging = $factory->createMessaging();
$message = CloudMessage::new()
->withNotification(['title' => 'Title', 'body' => 'Body']);
$messaging->send($message->withChangedTarget('token', '...'));
$messaging->send($message->withChangedTarget('topic', '...'));
I've downloaded my adminsdk from firebase and add it to my env file like
FIREBASE_CREDENTIALS="config/xxxx-xxxx-firebase-adminsdk-xxxx-xxxx.json"
but when I'm trying to send notification it returns this errorhere is my code: