Пример #1
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;
     }
 }
Пример #2
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();
     }
 }
Пример #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();
     }
 }