400 Bad Request response: "registration_ids" field cannot be empty
CeCallejas opened this issue · comments
Cesar Callejas commented
This error is shown when trying to send a notification with the following code:
$push = new PushNotification;
$push->setMessage([
'notification' => [
'title'=>'This is the title',
'body'=>'This is the message',
'sound' => 'default',
]
])
->setApiKey('AIzaSyBJalCHbX')
->send();
Eduardo Marcos commented
Hi @LyckanSv
As described in the documentation, you must definite the devide token/s to send the notification to.
So, aside the setApiKey method, you have to use the following method:
setDevicesToken
Have a look again at the documentation to see the examples.