I have built web version in Codeigniter and have been working in mobile version with react Native. To make new order notification, I am going to use firebase clouding message. how , where can I get this device token ?
public function sendFCMNotification($registration_ids, $message){
$SERVER_API_KEY ='my server api key';
// payload data, it will vary according to requirement
$data = [
"registration_ids" => $registration_ids,
"data" => $message
];
$dataString = json_encode($data);
$headers = [
'Authorization: key=' . $SERVER_API_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_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}