Edujugon / PushNotification

PHP and Laravel Package to send push notifications to Android and IOS devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

400 Bad Request response: "registration_ids" field cannot be empty

CeCallejas opened this issue · comments

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();

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.