<?php $appid = 23961; $acts = "[\"2,com.example.webpage_game_platform,com.example.webpage_game_platform.MainActivity\"]"; $title = 'title'; $extra = array('handle_by_app' => '1'); $token = 'BYi2gVsgCnsL'; $msg = 'offline'; $adpns = new SaeADPNS(); $result = $adpns->push($appid, $token, $title, $msg, $acts, $extra); if ($result) { echo '发送成功!'; var_dump($result); } else { echo '发送失败。'; var_dump($apns->errno(), $apns->errmsg()); }
public function pushMsg() { $appid = 23763; $token = 'BYfkQcUYULUB'; $title = 'title'; $msg = 'hello wolrd'; $acts = "[\"2,sina.Apns,sina.Apns.MainActivity\"]"; $extra = array('handle_by_app' => '0'); $adpns = new SaeADPNS(); $result = $adpns->push($appid, $token, $title, $msg, $acts, $extra); if ($result && is_array($result)) { echo '发送成功!'; var_dump($result); } else { echo '发送失败。'; var_dump($apns->errno(), $apns->errmsg()); } }
public function cloudPush($msg) { $appid = 22492; $token = 'BYfkQcUYULUB'; $title = 'title'; $msg = 'hello wolrd'; $acts = "[\"2,sina.Apns,sina.Apns.MainActivity\"]"; $extra = array('handle_by_app' => '0'); $adpns = new SaeADPNS(); //appid 是应用的标识,从SAE的推送服务页面申请 //token 是SDK通道标识,从SDK的onPush中获取 $result = $adpns->push($appid, $token, $title, $msg, $acts, $extra); if ($result && is_array($result)) { var_dump($result); return true; } else { var_dump($apns->errno(), $apns->errmsg()); return false; } }