您的位置:首页 > 编程语言 > Java开发

JPush极光推送Java服务器端API

2013-02-20 19:00 459 查看
参数名称参数类型选项内容说明
masterSecret

String必须Portal上注册应用时生成的 masterSecret
appKeyString必须Portal上注册应用时生成的 appKey
timeToLivelong可选保存离线消息的时长。秒为单位。最多支持10天(864000秒)。
0 表示该消息不保存离线。即:用户在线马上发出,当前不在线用户将不会收到此消息。
此参数不设置则表示默认,默认为保存1天的离线消息(86400秒)。

DeviceEnumEnum可选指定的设备。
可选值:DeviceEnum.Android, DeviceEnum.IOS。
不填或者null值为同时支持 Android 与 iOS。

发送消息

JPushClient公共方法

方法名称参数列表(必须)方法说明
setEnableSSLboolean enableSSL (true为使用ssl, 默认为不使用ssl)是否启动ssl安全连接
sendNotificationWithImei

int sendNo(发送编号),
String imei (IMEI字符串) ,
String msgTitle (消息标题/通知标题) ,
String msgContent (消息内容/通知内容)
发送带IMEI的通知
sendNotificationWithImeiint sendNo ,
String imei ,
String msgTitle ,
String msgContent ,
int builderId (自定义通知栏样式Id) ,
Map<String, Object>extra (附属信息)
自定义通知栏(没有则填写0)
以及传递附属信息
sendCustomMessageWithImei

int sendNo ,
String imei ,
String msgTitle ,
String msgContent
发送带IMEI的消息
sendCustomMessageWithImeiint sendNo ,
String imei ,
String msgTitle ,
String msgContent,
String msgContentType (消息内容类型,原样返回),
Map<String, Object> extra
用户自定义消息类型,
以及传递附属信息
sendNotificationWithTag

int sendNo ,
String tag (Tag字符串) ,
String msgTitle ,
String msgContent
发送带Tag的通知
sendNotificationWithTagint sendNo ,
String tag ,
String msgTitle ,
String msgContent ,
int builderId ,
Map<String, Object>extra
自定义通知栏(没有则填写0)
以及传递附属信息
sendCustomMessageWithTag

int sendNo ,
String tag ,
String msgTitle ,
String msgContent
发送带Tag的消息
sendCustomMessageWithTag
int sendNo ,
String tag ,
String msgTitle ,
String msgContent ,
String msgContentType ,
Map<String, Object> extra
用户自定义消息类型,
以及传递附属信息
sendNotificationWithAlias

int sendNo ,
String alias (Alias字符串) ,
String msgTitle ,
String msgContent
发送带Alias的通知
sendNotificationWithAliasint sendNo ,
String alias (Alias字符串) ,
String msgTitle ,
String msgContent ,
int builderId ,
Map<String, Object>extra
自定义通知栏(没有则填写0)
以及传递附属信息
sendCustomMessageWithAlias

int sendNo ,
String alias ,
String msgTitle ,
String msgContent
发送带Alias的消息
sendCustomMessageWithAliasint sendNo ,
String alias ,
String msgTitle ,
String msgContent ,
String msgContentType ,
Map<String, Object> extra
用户自定义消息类型,
以及传递附属信息
sendNotificationWithAppKey

int sendNo ,
String msgTitle ,
String msgContent
发送通知给AppKey的所有用户
sendNotificationWithAppKeyint sendNo ,
String msgTitle ,
String msgContent ,
int builderId ,
Map<String, Object>extra
自定义通知栏(没有则填写0)
以及传递附属信息
sendCustomMessageWithAppKey

int sendNo ,
String msgTitle ,
String msgContent
发送带AppKey的消息
sendCustomMessageWithAppKeyint sendNo ,
String msgTitle ,
String msgContent ,
String msgContentType ,
Map<String, Object> extra
用户自定义消息类型,
以及传递附属信息

代码示例

代码示例-发送带IMEI的通知

代码示例-IOS设置通知铃声和badge

MessageResult 类

公共方法方法用途
getSendno

消息发送成功后,按客户端传输的sendNo原样返回
getErrcode

错误代码,代码定义参考ErrorCodeEnum
getErrmsg返回错误消息的描述

ErrorCode 类

错误代码-ErrorCodeEnum

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: