function set_pushInfo($actionLocKey, $badge, $message, $sound, $payload, $locKey, $locArgs, $launchImage)
 {
     $this->pushInfo = new PushInfo();
     $this->pushInfo->set_actionLocKey($actionLocKey);
     $this->pushInfo->set_badge($badge);
     $this->pushInfo->set_message($message);
     if ($sound != null) {
         $this->pushInfo->set_sound($sound);
     }
     if ($payload != null) {
         $this->pushInfo->set_payload($payload);
     }
     if ($locKey != null) {
         $this->pushInfo->set_locKey($locKey);
     }
     if ($locArgs != null) {
         $this->pushInfo->set_locArgs($locArgs);
     }
     if ($launchImage != null) {
         $this->pushInfo->set_launchImage($launchImage);
     }
     $payloadLen = ApnsUtils::validatePayloadLength($locKey, $locArgs, $message, $actionLocKey, $launchImage, $badge, $sound, $payload);
     if ($payloadLen > 256) {
         $errorMsg = "PushInfo length over limit: " . (string) $payloadLen . ". Allowed: 256.";
         //echo $errorMsg;
         throw new Exception($errorMsg);
     }
 }
Пример #2
0
 static function validatePayloadLength($locKey, $locArgs, $message, $actionLocKey, $launchImage, $badge, $sound, $payload)
 {
     $json = ApnsUtils::processPayload($locKey, $locArgs, $message, $actionLocKey, $launchImage, $badge, $sound, $payload);
     return strlen($json);
 }
Пример #3
0
function getPushInfoLen()
{
    $rep = ApnsUtils::validatePayloadLength("近日,房祖名因为吸毒被抓引起了不小的震荡。不少厂商也由此撤销代言广告。近日又有台湾媒体报道称,房祖名原定于8月18日参加某真人秀节目录影,但因为被抓未能出席,遭节目制作方索赔2500万(约500万人民币)元违约金。另外,谢霆锋的师妹洛诗和常一娇因吸毒被抓的消息得到证实。", "", "b", "a", "", "4", "com.gexin.ios.silence", "DDDD", 0);
    var_dump($rep);
    echo "<br><br>";
}