FCM-OnDeviceNotificationScheduler
FCM-OnDeviceNotificationScheduler copied to clipboard
Possible Using Postman ?
i'm working on alarm Api, here i need to send notification on Perticuler time it is not working ? it is possible Using Api ?
Here is my code to send push notification
public function sendPushNotification($fcm_token, $title, $message, $time) {
$notification = array('title' => $title, 'text' => $message, 'sound' => 'default', 'badge' => '1', 'isScheduled' => 'true',
"scheduledTime" => $time);
$msg = array('to' => $fcm_token, 'notification' => $notification, 'priority' => 'high');
$server_key = env("SERVER_KEY");
$headers = array(
"Authorization: key= $server_key",
"Content-Type: application/json"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($msg));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
Yes it's possible
i'm adding alarm using postman but not showing in local on particular time. its show direct when I run api
any changes from my code ? @PatilShreyas
bhai please answer dede @PatilShreyas
Did you tested the current implementation using POSTMan first? If you do so, you can be sure about its implementation from the Android side as well