douaikuai2715 2016-04-04 08:13
浏览 70
已采纳

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

I have created development app in urbanairship and trying to send push notification from server using PHP code.

My code:

        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 . "
";

But I'm getting :

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

Any help would be appreciated.

  • 写回答

1条回答 默认 最新

  • douxuan0698 2016-04-06 20:00
    关注

    Message Center is not included in the Start or Basic accounts. Contact support and they will work with you to add Message Center entitlements.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂