Ejemplo n.º 1
0
 function sendIOSBroadcast($arr)
 {
     try {
         $brocast = new IOSBroadcast();
         $brocast->setAppMasterSecret($this->appMasterSecret);
         $brocast->setPredefinedKeyValue("appkey", $this->appkey);
         $brocast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $brocast->setPredefinedKeyValue("alert", $arr['text']);
         $brocast->setPredefinedKeyValue("badge", 0);
         $brocast->setPredefinedKeyValue("sound", "chime");
         $brocast->setPredefinedKeyValue("description", $arr['text']);
         // Set 'production_mode' to 'true' if your app is under production mode
         $brocast->setPredefinedKeyValue("production_mode", "false");
         // Set customized fields
         $brocast->setCustomizedField("code", $arr['code'] ? $arr['code'] : 0);
         //			print("Sending broadcast notification, please wait...\r\n");
         $brocast->send();
         //			print("Sent SUCCESS\r\n");
         return true;
     } catch (Exception $e) {
         return false;
         print "Caught exception: " . $e->getMessage();
         die;
     }
 }
Ejemplo n.º 2
0
 function sendIOSBroadcast()
 {
     try {
         $brocast = new IOSBroadcast();
         $brocast->setAppMasterSecret($this->appMasterSecret);
         $brocast->setPredefinedKeyValue("appkey", $this->appkey);
         $brocast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $brocast->setPredefinedKeyValue("alert", "IOS 广播测试");
         $brocast->setPredefinedKeyValue("badge", 0);
         $brocast->setPredefinedKeyValue("sound", "chime");
         // Set 'production_mode' to 'true' if your app is under production mode
         $brocast->setPredefinedKeyValue("production_mode", "false");
         // Set customized fields
         $brocast->setCustomizedField("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();
     }
 }
Ejemplo n.º 3
0
 function sendIOSBroadcast($text, $type, $nid, $url)
 {
     try {
         $brocast = new IOSBroadcast();
         $brocast->setAppMasterSecret($this->appMasterSecret);
         $brocast->setPredefinedKeyValue("appkey", $this->appkey);
         $brocast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $brocast->setPredefinedKeyValue("alert", $text);
         $brocast->setPredefinedKeyValue("badge", 0);
         $brocast->setPredefinedKeyValue("sound", "chime");
         // Set 'production_mode' to 'true' if your app is under production mode
         $brocast->setPredefinedKeyValue("production_mode", "true");
         // Set customized fields
         $brocast->setCustomizedField("type", $type);
         $brocast->setCustomizedField("newsid", $nid);
         $brocast->setCustomizedField("url", $url);
         $brocast->send();
         return "Sent SUCCESS\r\n";
     } catch (Exception $e) {
         return "Caught exception: " . $e->getMessage();
     }
 }