Overview

Namespaces

  • None
  • sinacloud
    • sae

Classes

  • SaeADPNS
  • SaeAPNS
  • SaeChannel
  • SaeDeferredJob
  • SaeFetchInternal
  • SaeKV
  • SaeMail
  • SaeMysql
  • SaeSegment
  • SaeTAdvance
  • SaeTaskQueue
  • SaeTClientV2
  • SaeTOAuthV2
  • SaeVCode
  • vDisk

Exceptions

  • OAuthException
  • Overview
  • Namespace
  • Class

Class SaeADPNS

Android 应用消息推送服务

<?php
$appid=20001;
$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());
}
?>

错误码参考: - errno: 0 成功 - errno: -1 信息内容为空 - errno: -2 连接server http请求错误 - errno: -3 server端错误

SaeObject
Extended by SaeADPNS
Package: sae
Located at saeadpns.class.php
Methods summary
public
# __construct( )

构造对象

构造对象

public boolean
# push( integer $appid, string $token, string $title, string $msg, string $acts, array $extra = array() )

推送消息

推送消息

Parameters

$appid
SAE分配的应用序号
$token
设备令牌
$title
消息标题
$msg
消息体
$acts

跳转行为参数 - ["2,app包名,Activity类名"]:跳转到APP的Activity。例如:["2,com.sina.news,com.sina.news.ui.NewContentActivity"] - ["4,URL地址"]:跳转到浏览器。例如:["4,http://www.sina.com"] - ["5,Scheme"]:通过Scheme跳转。例如:["5,sinaweibo://sendweibo"]

$extra

额外的传递信息 - $extra = array( 'handle_by_app'=>'1' // "1",表示消息交由App处理。 )

Returns

boolean
成功返回true,失败返回false
public integer
# errno( )

取得错误码

取得错误码

Returns

integer

Author

Elmer Zhang
public string
# errmsg( )

取得错误信息

取得错误信息

Returns

string

Author

Elmer Zhang
API documentation generated by ApiGen