首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Appkey无权使用Urbanairship中的消息中心

Appkey无权使用Urbanairship中的消息中心
EN

Stack Overflow用户
提问于 2016-04-04 08:13:08
回答 1查看 262关注 0票数 1

我在城市飞船上创建了开发应用程序,并试图使用PHP代码从服务器发送推送通知。

我的代码:

代码语言:javascript
复制
        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";

但我得到了:

代码语言:javascript
复制
Response: {"ok":false,"error":"The specified appkey [xxx] is not entitled to use the Message Center.","error_code":403} 

任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-06 20:00:27

消息中心不包括在“开始”或“基本”帐户中。与支持联系,他们将与您一起添加Message权益。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36397523

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档