Esempio n. 1
0
 private function ios()
 {
     $template = new IGtTransmissionTemplate();
     $template->set_appId(APPID);
     //应用appid
     $template->set_appkey(APPKEY);
     //应用appkey
     $template->set_transmissionType(2);
     //透传消息类型
     #$template->set_transmissionContent("title=".title.'&nr='.nr."&type=".type."&id=".id);//透传内容
     $template->set_transmissionContent("title=" . TITLE . '&content=' . CONTENT . "&type=" . TYPE . "&id=" . ID);
     //透传内容
     #$template->set_pushInfo("actionLocKey","badge","message","sound","payload","locKey","locArgs","launchImage");
     $apn = new IGtAPNPayload();
     $alertmsg = new SimpleAlertMsg();
     $alertmsg->alertMsg = "";
     $apn->alertMsg = $alertmsg;
     $apn->badge = 2;
     $apn->sound = "";
     $apn->add_customMsg("payload", "title=" . TITLE . '&content=' . CONTENT . "&type=" . TYPE . "&id=" . ID);
     #        $apn->contentAvailable=1;
     $apn->category = "ACTIONABLE";
     $template->set_apnInfo($apn);
     $igt = new IGeTui(HOST, APPKEY, MASTERSECRET);
     $message = new IGtSingleMessage();
     $message->set_data($template);
     $ret = $igt->pushAPNMessageToSingle(APPID, DEVICETOKEN, $message);
     var_dump($ret);
 }
Esempio n. 2
0
 function set_pushInfo($actionLocKey, $badge, $message, $sound, $payload, $locKey, $locArgs, $launchImage, $contentAvailable = 0)
 {
     $this->pushInfo = new PushInfo();
     $this->pushInfo->set_invalidAPN(true);
     $this->pushInfo->set_invalidMPN(true);
     $apn = new IGtAPNPayload();
     $alertMsg = new DictionaryAlertMsg();
     if ($actionLocKey != null && $actionLocKey != '') {
         $alertMsg->actionLocKey = $actionLocKey;
     }
     if ($message != null && $message != '') {
         $alertMsg->body = $message;
     }
     if ($locKey != null && $locKey != '') {
         $alertMsg->locKey = $locKey;
     }
     if ($locArgs != null && $locArgs != '') {
         array_push($alertMsg->locArgs, $locArgs);
     }
     if ($launchImage != null && $launchImage != '') {
         $alertMsg->launchImage = $launchImage;
     }
     $apn->alertMsg = $alertMsg;
     if ($badge != null) {
         $apn->badge = $badge;
     }
     if ($sound != null && $sound != '') {
         $apn->sound = $sound;
     }
     if ($contentAvailable != null) {
         $apn->contentAvailable = $contentAvailable;
     }
     if ($payload != null && $payload != '') {
         $apn->add_customMsg("payload", $payload);
     }
     $this->set_apnInfo($apn);
 }
Esempio n. 3
0
function IGtTransmissionTemplateDemo()
{
    $template = new IGtTransmissionTemplate();
    $template->set_appId(APPID);
    //应用appid
    $template->set_appkey(APPKEY);
    //应用appkey
    $template->set_transmissionType(1);
    //透传消息类型
    $template->set_transmissionContent("测试离线ddd");
    //透传内容
    //$template->set_duration(BEGINTIME,ENDTIME); //设置ANDROID客户端在此时间区间内展示消息
    //APN简单推送
    //        $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高级推送
    $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 = "";
    $apn->add_customMsg("payload", "payload");
    $apn->contentAvailable = 1;
    $apn->category = "ACTIONABLE";
    $template->set_apnInfo($apn);
    //PushApn老方式传参
    //    $template = new IGtAPNTemplate();
    //          $template->set_pushInfo("", 10, "", "com.gexin.ios.silence", "", "", "", "");
    return $template;
}
Esempio n. 4
0
 private function touchuandemo()
 {
     $template = new IGtTransmissionTemplate();
     $template->set_appId(APPID);
     //应用appid
     $template->set_appkey(APPKEY);
     //应用appkey
     $template->set_transmissionType(2);
     //透传消息类型
     $template->set_transmissionContent("url=" . url . "&title=" . title . '&nr=' . nr . "&type=" . type . "&id=" . id);
     //透传内容
     #$template->set_pushInfo("actionLocKey","badge","message","sound","payload","locKey","locArgs","launchImage");
     $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);
     return $template;
 }