PHP Firebase通知显示在托盘中,但不会弹出
我正在使用php将使用firebase的推送通知发送到使用unity构建的Android应用程序。 应用程序正在接收通知并将其显示在托盘中,但不会像应用程序或其他应用程序那样将其显示为弹出式通知 我的php代码是:PHP Firebase通知显示在托盘中,但不会弹出,php,android,firebase,unity3d,firebase-cloud-messaging,Php,Android,Firebase,Unity3d,Firebase Cloud Messaging,我正在使用php将使用firebase的推送通知发送到使用unity构建的Android应用程序。 应用程序正在接收通知并将其显示在托盘中,但不会像应用程序或其他应用程序那样将其显示为弹出式通知 我的php代码是: function send_notification ($tokens, $message){ $url = 'https://fcm.googleapis.com/fcm/send'; $notification= array('title' => 'Winn
function send_notification ($tokens, $message){
$url = 'https://fcm.googleapis.com/fcm/send';
$notification= array('title' => 'Winner!!','body' => $message);
$data= array('custom_notification' => $custom_notification );
$fields = array(
'registration_ids' => $tokens,
'notification' => $notification,
);
$headers = array(
'Authorization:key = AAAA5C-Y_Ew:APA91bFD1g98n19DZD8FkaEYiME4tDsniePTKU1sGww1EAD7dtSKP6FEqlRGcTpB_MCD_7UM7ToWis1VnZO-dtDXMLFSZtaSIDAQ0fACbJ_SOFjWd93klckboahy3eZr93Z9M02LfP_s',
'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_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
return $result;
}
它还显示灰度图标,而不是彩色图标。
我想将通知显示为弹出窗口。
是否仍然可以使用FCM执行此操作?而不是“通知”=>$notification仅使用数据键,同时仅为android发送通知
iOS只需要“通知”=>$通知。我尝试使用数据密钥,但使用数据密钥时,手机根本无法接收到通知