【问题标题】:Appkey is not entitled to use the Message Center in UrbanairshipAppkey 无权使用 Urbanairship 中的消息中心
【发布时间】:2016-04-04 08:13:08
【问题描述】:

我在 urbanairship 中创建了开发应用程序,并尝试使用 PHP 代码从服务器发送推送通知。

我的代码:

        define('APPKEY','xxx'); // Your App Key
        define('PUSHSECRET', 'ytyy'); // Your Master Secret
        define('PUSHURL', 'https://go.urbanairship.com/api/push/');
        $notification = array();
        $notification['alert'] = "alert";
        $platform = array();
        array_push($platform, "android"); //comment out if you don't want Android
        $richpush = array();
        $richpush['title'] = "title";
        $richpush['body'] = $message;


        if(strlen($deviceToken)>50){
            $deviceToken=str_replace(" ","",$deviceToken);
            $push = array("audience"=>array("device_token"=>$deviceToken), "notification"=>$notification, "device_types"=>$platform, "message"=>$richpush);
        }else{
            $deviceToken=str_replace(" ","-",$deviceToken);
            $push = array("audience"=>array("apid"=>$deviceToken),              "notification"=>$notification, "device_types"=>$platform, "message"=>$richpush);
        }

        $json = json_encode($push);


        $session = curl_init(PUSHURL);
        curl_setopt($session, CURLOPT_USERPWD, APPKEY . ':' . PUSHSECRET);
        curl_setopt($session, CURLOPT_POST, True);
        curl_setopt($session, CURLOPT_POSTFIELDS, $json);
        curl_setopt($session, CURLOPT_HEADER, False);
        curl_setopt($session, CURLOPT_RETURNTRANSFER, True);
        curl_setopt($session, CURLOPT_HTTPHEADER, array('Content-Type:application/json', 'Accept: application/vnd.urbanairship+json; version=3;'));
        $content = curl_exec($session);
        echo "Response: " . $content . "\n";

但我得到了:

Response: {"ok":false,"error":"The specified appkey [xxx] is not entitled to use the Message Center.","error_code":403} 

任何帮助将不胜感激。

【问题讨论】:

    标签: php push-notification urbanairship.com


    【解决方案1】:

    消息中心不包含在 Start 或 Basic 帐户中。联系support,他们将与您一起添加消息中心权利。

    【讨论】:

    • 是否需要消息中心才能从服务器集成发送推送通知?我找不到这个问题的明确答案。
    • 不,消息中心只需要发送消息中心消息。推送通知可以在有或没有消息中心消息的情况下发送。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 2021-01-28
    • 2018-08-25
    • 2017-01-15
    • 2018-11-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多