public function PushTokenIos($content, $token) { $iosConfig = $this->config['iOS']; $accessId = $iosConfig['accessId']; $secretKey = $iosConfig['secretKey']; $environment = $iosConfig['environment'] == 'production' ? XingeApp::IOSENV_PROD : XingeApp::IOSENV_DEV; return XingeApp::PushTokenIos($accessId, $secretKey, $content, $token, $environment); }
/** * 使用默认配置发个特别简单的通知IOS * @return 返回push_id */ public static function pushSimpleMessageIos($paramArr) { $options = array('accessId' => '', 'secretKey' => '', 'content' => '', 'token' => '', 'account' => '', 'userId' => ''); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); if (!$accessId || !$secretKey || !$token && !$account || !$content) { return false; } if ($token) { $ret = XingeApp::PushTokenIos($accessId, $secretKey, $content, $token, XingeApp::IOSENV_PROD); } else { $ret = XingeApp::PushAccountIos($accessId, $secretKey, $content, $account, XingeApp::IOSENV_PROD); } 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));