Create Registration and send notification
composer require phuocdaivl/azure-noti
Add the service provider to the providers array in the config/app.php
config file as follows:
'providers' => [
...
DaiDP\AzureNoti\Providers\AzureNotiServiceProvider::class,
]
Well done.
use \DaiDP\AzureNoti\PlatformFactory;
$endpoint = PlatformFactory::getEndpoint(PlatformFactory::ENDPOINT_FCM);
The following methods are available on the PlatformEndpoint instance.
Create or update Registration ID
$fcmRegistration = 'fPDLWe0fKpY:APA91bHocOJCoKx5GV9ETT0bUmJDQAWiT8Ql4zFB5Ycr_sAm6tQ6aOmcTnGC3LwiyCa-beaXZoWrkxWTDvBkUVE8Th_XWNQUdzeNlbZ2MmT-lVj4Gxe4baoqVYYtmoAvZvZxghPZirOo';
$tags = ['tag1', 'tag2'];
$result = $endpoint->createRegistration($fcmRegistration, $tags);
Set new password for account
$message = new \DaiDP\AzureNoti\Message([
'title' => 'Test push notification',
'body' => 'great match!'
]);
$fcmRegistration = 'fPDLWe0fKpY:APA91bHocOJCoKx5GV9ETT0bUmJDQAWiT8Ql4zFB5Ycr_sAm6tQ6aOmcTnGC3LwiyCa-beaXZoWrkxWTDvBkUVE8Th_XWNQUdzeNlbZ2MmT-lVj4Gxe4baoqVYYtmoAvZvZxghPZirOo';
$result = $endpoint->sendNativeNotification($device, $message);