Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Firebase通知显示在托盘中,但不会弹出_Php_Android_Firebase_Unity3d_Firebase Cloud Messaging - Fatal编程技术网

PHP Firebase通知显示在托盘中,但不会弹出

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

我正在使用php将使用firebase的推送通知发送到使用unity构建的Android应用程序。 应用程序正在接收通知并将其显示在托盘中,但不会像应用程序或其他应用程序那样将其显示为弹出式通知

我的php代码是:

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只需要“通知”=>$通知。

我尝试使用数据密钥,但使用数据密钥时,手机根本无法接收到通知