public function PushAllAndroid($title, $content) { $iosConfig = $this->config['Android']; $accessId = $iosConfig['accessId']; $secretKey = $iosConfig['secretKey']; return XingeApp::PushAllAndroid($accessId, $secretKey, $title, $content); }
/** * 推送消息给所有设备 * title和environment区分IOS还是ANDROID */ public static function pushAllMessage($paramArr) { $options = array('accessId' => '', 'secretKey' => '', 'title' => '', 'content' => '', 'environment' => 0); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); if (!$accessId || !$secretKey || !$content) { return false; } if ($environment == 0 && $title) { //ANDROID $ret = XingeApp::PushAllAndroid($accessId, $secretKey, $title, $content); } else { //IOS $ret = XingeApp::PushAllIos($accessId, $secretKey, $content, $environment); } return $ret; }
<?php require_once 'XingeApp.php'; //Android 版 //给单个设备下发通知 var_dump(XingeApp::PushTokenAndroid(10000, "secretKey", "title", "content", "token")); //给单个帐号下发通知 var_dump(XingeApp::PushAccountAndroid(10000, "secretKey", "title", "content", "account")); //给所有设备下发通知 var_dump(XingeApp::PushAllAndroid(10000, "secretKey", "title", "content")); //给标签选中设备下发通知 var_dump(XingeApp::PushTagAndroid(10000, "secretKey", "title", "content", "tag")); //IOS版 //开发环境下 给单个设备下发通知 var_dump(XingeApp::PushTokenIos(10000, "secretKey", "content", "token", XingeApp::IOSENV_DEV)); //开发环境下 给单个帐号下发通知 var_dump(XingeApp::PushAccountIos(10000, "secretKey", "content", "account", XingeApp::IOSENV_DEV)); //开发环境下 给所有设备下发通知 var_dump(XingeApp::PushAllAndroid(10000, "secretKey", "content", XingeApp::IOSENV_DEV)); //开发环境下 给标签选中设备下发通知 var_dump(XingeApp::PushTagAndroid(10000, "secretKey", "content", "tag", XingeApp::IOSENV_DEV));