Пример #1
0
 public function pushAPN($pDevicetoken)
 {
     $template = new IGtAPNTemplate();
     $template->set_pushInfo("", 1, "推送的要不要", "", "", "", "", "");
     $message = new IGtSingleMessage();
     $message->set_data($template);
     $ret = $this->pushAPNMessageToSingle($this->tAppid, $pDevicetoken, $message);
     var_dump($ret);
 }
Пример #2
0
function pushAPN()
{
    $igt = new IGeTui(HOST, APPKEY, MASTERSECRET);
    $template = new IGtAPNTemplate();
    $template->set_pushInfo("", 1, "dd", "", "", "", "", "", 1);
    $message = new IGtSingleMessage();
    $message->set_data($template);
    $ret = $igt->pushAPNMessageToSingle(APPID, DEVICETOKEN, $message);
    var_dump($ret);
}
Пример #3
0
function pushAPNL()
{
    //APN简单推送
    //        $igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
    //        $template = new IGtAPNTemplate();
    //        $apn = new IGtAPNPayload();
    //        $alertmsg=new SimpleAlertMsg();
    //        $alertmsg->alertMsg="";
    //        $apn->alertMsg=$alertmsg;
    ////        $apn->badge=2;
    ////        $apn->sound="";
    //        $apn->add_customMsg("payload","payload");
    //        $apn->contentAvailable=1;
    //        $apn->category="ACTIONABLE";
    //        $template->set_apnInfo($apn);
    //        $message = new IGtSingleMessage();
    //APN高级推送
    $igt = new IGeTui(HOST, APPKEY, MASTERSECRET);
    $template = new IGtAPNTemplate();
    $apn = new IGtAPNPayload();
    //        $alertmsg=new DictionaryAlertMsg();
    //        $alertmsg->body="body";
    //        $alertmsg->actionLocKey="ActionLockey";
    //        $alertmsg->locKey="LocKey";
    //        $alertmsg->locArgs=array("locargs");
    //        $alertmsg->launchImage="launchimage";
    ////        IOS8.2 支持
    //        $alertmsg->title="Title";
    //        $alertmsg->titleLocKey="TitleLocKey";
    //        $alertmsg->titleLocArgs=array("TitleLocArg");
    //        $apn->alertMsg=$alertmsg;
    //        $apn->badge=7;
    //        $apn->sound="com.gexin.ios.silence";
    $apn->add_customMsg("payload", "payload");
    //        $apn->contentAvailable=1;
    //        $apn->category="ACTIONABLE";
    $template->set_apnInfo($apn);
    $message = new IGtSingleMessage();
    //PushApn老方式传参
    //    $igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
    //    $template = new IGtAPNTemplate();
    //    $template->set_pushInfo("", 4, "", "", "", "", "", "");
    //    $message = new IGtSingleMessage();
    //多个用户推送接口
    putenv("needDetails=true");
    $listmessage = new IGtListMessage();
    $listmessage->set_data($template);
    $contentId = $igt->getAPNContentId(APPID, $listmessage);
    //$deviceTokenList = array("3337de7aa297065657c087a041d28b3c90c9ed51bdc37c58e8d13ced523f5f5f");
    $deviceTokenList = array(DEVICETOKEN);
    $ret = $igt->pushAPNMessageToList(APPID, $contentId, $deviceTokenList);
    var_dump($ret);
}
Пример #4
0
/**
 * 单推APN接口示例
 * @param $token  推送的客户端APN标识
 * @param $c  推送消息显示的内容
 * @param $p  推送消息的数据内容
 */
function apnMessageToSingle($token, $c, $p)
{
    global $igt;
    $template = new IGtAPNTemplate();
    //$template ->set_pushInfo($actionLocKey,$badge,$message,$sound,$payload,$locKey,$locArgs,$launchImage);
    $template->set_pushInfo("", 1, $c, "", $p, "", "", "");
    //单个用户推送接口
    $message = new IGtSingleMessage();
    $message->set_data($template);
    $ret = $igt->pushAPNMessageToSingle(APPID, $token, $message);
    var_dump($ret);
}