Esempio n. 1
0
 function sendAndroidBroadcast()
 {
     try {
         $brocast = new AndroidBroadcast();
         $brocast->setAppMasterSecret($this->appMasterSecret);
         $brocast->setPredefinedKeyValue("appkey", $this->appkey);
         $brocast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $brocast->setPredefinedKeyValue("ticker", "Android broadcast ticker");
         $brocast->setPredefinedKeyValue("title", "中文的title");
         $brocast->setPredefinedKeyValue("text", "Android broadcast text");
         $brocast->setPredefinedKeyValue("after_open", "go_app");
         // Set 'production_mode' to 'false' if it's a test device.
         // For how to register a test device, please see the developer doc.
         $brocast->setPredefinedKeyValue("production_mode", "true");
         // [optional]Set extra fields
         $brocast->setExtraField("test", "helloworld");
         print "Sending broadcast notification, please wait...\r\n";
         $brocast->send();
         print "Sent SUCCESS\r\n";
     } catch (Exception $e) {
         print "Caught exception: " . $e->getMessage();
     }
 }
Esempio n. 2
0
 function sendAndroidBroadcast($arr)
 {
     //        print_r($arr);die;
     try {
         $brocast = new AndroidBroadcast();
         $brocast->setAppMasterSecret($this->appMasterSecret);
         $brocast->setPredefinedKeyValue("appkey", $this->appkey);
         $brocast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $brocast->setPredefinedKeyValue("ticker", $arr['ticker']);
         $brocast->setPredefinedKeyValue("title", $arr['title']);
         $brocast->setPredefinedKeyValue("text", $arr['text']);
         $brocast->setPredefinedKeyValue("after_open", "go_app");
         $brocast->setPredefinedKeyValue("description", $arr['text']);
         // Set 'production_mode' to 'false' if it's a test device.
         // For how to register a test device, please see the developer doc.
         $brocast->setPredefinedKeyValue("production_mode", "true");
         // [optional]Set extra fields
         $brocast->setExtraField("code", $arr['code'] ? $arr['code'] : 0);
         //			print("Sending broadcast notification, please wait...\r\n");
         $brocast->send();
         return true;
     } catch (Exception $e) {
         return false;
         print "Caught exception: " . $e->getMessage();
         die;
     }
 }
Esempio n. 3
0
 function sendAndroidBroadcast()
 {
     try {
         $brocast = new AndroidBroadcast();
         $brocast->setPredefinedKeyValue("appkey", $this->appkey);
         $brocast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $brocast->setPredefinedKeyValue("validation_token", $this->validation_token);
         $brocast->setPredefinedKeyValue("ticker", "快券推送");
         $brocast->setPredefinedKeyValue("title", "优惠券承兑完成");
         $brocast->setPredefinedKeyValue("text", "您的摩提工房美味摩提1元享18元套餐快券已使用,更多优惠在等着你哦!");
         $brocast->setPredefinedKeyValue("after_open", "go_app");
         // Set 'production_mode' to 'false' if it's a test device.
         // For how to register a test device, please see the developer doc.
         $brocast->setPredefinedKeyValue("production_mode", "true");
         // [optional]Set extra fields
         $brocast->setExtraField("test", "helloworld");
         print "Sending broadcast notification, please wait...\r\n";
         $brocast->send();
         print "Sent SUCCESS\r\n";
     } catch (Exception $e) {
         print "Caught exception: " . $e->getMessage();
     }
 }
Esempio n. 4
0
 function sendAndroidBroadcast($ticker, $title, $text, $json, $type)
 {
     try {
         $brocast = new AndroidBroadcast();
         $brocast->setAppMasterSecret($this->appMasterSecret);
         $brocast->setPredefinedKeyValue("appkey", $this->appkey);
         $brocast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $brocast->setPredefinedKeyValue("ticker", $ticker);
         $brocast->setPredefinedKeyValue("title", $title);
         $brocast->setPredefinedKeyValue("text", $text);
         if ($type == '4') {
             $brocast->setPredefinedKeyValue("after_open", "go_custom");
             $brocast->setPredefinedKeyValue("custom", $json);
         } else {
             if ($type == '1') {
                 $brocast->setPredefinedKeyValue("after_open", "go_app");
             } else {
                 if ($type == '2') {
                     $brocast->setPredefinedKeyValue("after_open", "go_url");
                     $brocast->setPredefinedKeyValue("url", $json);
                 }
             }
         }
         // Set 'production_mode' to 'false' if it's a test device.
         // For how to register a test device, please see the developer doc.
         $brocast->setPredefinedKeyValue("production_mode", "true");
         // [optional]Set extra fields
         //$brocast->setExtraField("test", "helloworld");
         $brocast->send();
         return "Sent SUCCESS";
     } catch (Exception $e) {
         return "Caught exception: " . $e->getMessage();
     }
 }
Esempio n. 5
0
 function sendAndroidBroadcast($ticker, $title, $text, $json)
 {
     try {
         $brocast = new AndroidBroadcast();
         $brocast->setAppMasterSecret($this->appMasterSecret);
         $brocast->setPredefinedKeyValue("appkey", $this->appkey);
         $brocast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $brocast->setPredefinedKeyValue("ticker", $ticker);
         $brocast->setPredefinedKeyValue("title", $title);
         $brocast->setPredefinedKeyValue("text", $text);
         $brocast->setPredefinedKeyValue("after_open", "go_custom");
         $brocast->setPredefinedKeyValue("custom", $json);
         // Set 'production_mode' to 'false' if it's a test device.
         // For how to register a test device, please see the developer doc.
         $brocast->setPredefinedKeyValue("production_mode", "true");
         // [optional]Set extra fields
         //$brocast->setExtraField("test", "helloworld");
         print "正在发送中,请稍等...\r\n";
         $brocast->send();
         print "发送成功\r\n";
     } catch (Exception $e) {
         print "Caught exception: " . $e->getMessage();
     }
 }