Esempio n. 1
0
 private function IGtNotificationTemplateDemo()
 {
     $template = new IGtNotificationTemplate();
     $template->set_appId(APPID);
     //应用appid
     $template->set_appkey(APPKEY);
     //应用appkey
     $template->set_transmissionType(1);
     //透传消息类型
     $template->set_transmissionContent("测试离线");
     //透传内容
     $template->set_title(title);
     //通知栏标题
     $template->set_text(nr);
     //通知栏内容
     $template->set_logo("");
     //通知栏logo
     $template->set_isRing(true);
     //是否响铃
     $template->set_isVibrate(true);
     //是否震动
     $template->set_isClearable(true);
     //通知栏是否可清除
     // iOS推送需要设置的pushInfo字段
     //$template ->set_pushInfo($actionLocKey,$badge,$message,$sound,$payload,$locKey,$locArgs,$launchImage);
     $template->set_pushInfo("test", 1, "", "", "", "", "", "");
     return $template;
 }
Esempio n. 2
0
 function IGtNotificationTemplateDemo($tsid = 0, $title = '', $content = '')
 {
     $template = new IGtNotificationTemplate();
     $template->set_appId(self::APPID);
     //应用appid
     $template->set_appkey(self::APPKEY);
     //应用appkey
     $template->set_transmissionType(1);
     //透传消息类型
     $template->set_transmissionContent($tsid);
     //透传内容
     $template->set_title($title);
     //通知栏标题
     $template->set_text($content);
     //通知栏内容
     $template->set_logo("http://www.meilimei.com/images/logo1031-114.png");
     //通知栏logo
     $template->set_isRing(true);
     //是否响铃
     $template->set_isVibrate(true);
     //是否震动
     $template->set_isClearable(true);
     //通知栏是否可清除
     // iOS推送需要设置的pushInfo字段
     $arr = explode(':', $content);
     if (strlen($content) > 100 || strlen($arr[3]) > 100) {
         $substr_content = substr($content, 0, 100);
         $substr_arr = substr($arr[3], 0, 100);
         $template->set_pushInfo("a", 0, $content, "com.gexin.ios.silence", $substr_content, $substr_arr, "", "");
     } else {
         $template->set_pushInfo("a", 0, $content, "com.gexin.ios.silence", $content, $arr[3], "", "");
     }
     //$template ->set_pushInfo($actionLocKey,$badge,$message,$sound,$payload,$locKey,$locArgs,$launchImage);
     //$template ->set_pushInfo("test",1,"message","","","","","");
     return $template;
 }
Esempio n. 3
0
 /**
  * 创建通知透传功能模板
  * 注:IOS离线推送需通过APN进行转发,需填写pushInfo字段,目前仅不支持通知弹框下载功能
  * @param array $options array(
  *     'transmission_content' => '',    // 透传内容
  *     'title'                => '',    // 通知栏标题
  *     'text'                 => '',    // 通知栏内容
  *     'is_ring'              => true,  // 是否响铃
  *     'is_vibrate'           => true,  // 是否震动
  *     'push_info' => array(
  *         'action_loc_key' => '',
  *         'badge'          => 0,
  *         'message'        => '',
  *         'sound'          => '',
  *         'payload'        => '',
  *         'loc_key'        => '',
  *         'loc_args'       => '',
  *         'launch_image'   => '',
  *     )
  *   )
  */
 public function createNotificationTemplate($options)
 {
     $_options = array('transmission_content' => isset($options['transmission_content']) ? $options['transmission_content'] : '透传内容', 'title' => isset($options['title']) ? $options['title'] : '个推', 'text' => isset($options['text']) ? $options['text'] : '个推最新版点击下载', 'is_ring' => isset($options['is_ring']) ? $options['is_ring'] : true, 'is_vibrate' => isset($options['is_vibrate']) ? $options['is_vibrate'] : true, 'push_info' => isset($options['push_info']) ? $options['push_info'] : '');
     $template = new IGtNotificationTemplate();
     $template->set_appId($this->_appid);
     // 应用appid
     $template->set_appkey($this->_appkey);
     // 应用appkey
     $template->set_transmissionType(1);
     // 透传消息类型
     $template->set_transmissionContent($_options['transmission_content']);
     // 透传内容
     $template->set_title($_options['title']);
     // 通知栏标题
     $template->set_text($_options['text']);
     // 通知栏内容
     $template->set_isRing($_options['is_ring']);
     // 是否响铃
     $template->set_isVibrate($_options['is_vibrate']);
     // 是否震动
     $template->set_isClearable(true);
     // 通知栏是否可清除
     // iOS推送需要设置的pushInfo字段
     if ($_options['push_info']) {
         $push_info = $_options['push_info'];
         $template->set_pushInfo($push_info['action_loc_key'], $push_info['badge'], $push_info['message'], $push_info['sound'], $push_info['payload'], $push_info['loc_key'], $push_info['loc_args'], $push_info['launch_image']);
         //$template ->set_pushInfo("test",1,"message","","","","","");
     }
     return $template;
 }