小编Jav*_*gas的帖子

当针对多个registration_ids时,fcm注册ID失败

我在php中从服务器端向几个注册ID发送通知.这是请求:

public function androidPushNotification($registration_ids, $title, $message) {
    $msg = array (
            'message' => $message,
            'title' => $title 
    );

    $fields = array (
            'registration_ids' => $registration_ids,
            'data' => $msg 
    );

    $headers = array (
            'Authorization: key=' . $this->API_ACCESS_KEY,
            'Content-Type: application/json' 
    );

    $ch = curl_init ();
    curl_setopt ( $ch, CURLOPT_URL, $this->GCM_URL );
    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 ( …
Run Code Online (Sandbox Code Playgroud)

php android google-cloud-messaging firebase-cloud-messaging

4
推荐指数
1
解决办法
1484
查看次数