I created the p8 file in apple developer page. and integrated all the necessary steps for firebase push notifications with flutter.
When i try to send the notification from firebase console. the message shows in the app. but if try with the PHP FCM code the notification not arrives. but the curl request returns success.
I have spend more than 2 days to find the solution. please help me to rectify this issue.
Firebase Console
FCM code in PHP
$serverKey = '150 characters server key';
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array(
'registration_ids' => [
"dwUpMuQLfU1DtoVJtP9MF8:APA91bHLxdctbSvx-7e1YZTPwq6I0_A_lVpyTH5F6jLeIlnsmsdD_D6cqkym6XRoYOhCT6JYhubzaYmytb3P5Wyv6rJCR3FBDjpu0YIH803b0bl7eKEq3egdbXRUkH6PQzHkcelCGaEW",
"ea2RfrXsT7CA51U0ZCLMqR:APA91bEcnGd69w8crkGx8MAVUsNbZqBScaNkgEmOuck-fKb0vYqtm741z9D3u0pSgVjQLxJG__8GAQzRQvTGYzaY6ve7WoPF7xGZozoOpnxHkTyMpRsLtCcML5XVNVvS-Me3A4MhjiaG"
],
'data' => array(
"message" => "Test Message",
"title" => "Admin Responded to your Grievance",
"time" => strtotime($date) * 1000,
"type" => "notification",
"message" => "Test Message",
"time" => strtotime($date) * 1000,
"sound" => "default",
)
);
$fields = json_encode($fields);
$headers = array(
'Authorization: key=' . $serverKey,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
