轉載自:http://www.cnblogs.com/zhanghaoh/archive/2013/02/20/2919282.html
|
參數名稱 | 參數類型 | 選項 | 内容說明 |
---|---|---|---|
| String | 必須 | Portal上注冊應用時生成的 masterSecret |
appKey | Portal上注冊應用時生成的 appKey | ||
timeToLive | long | 可選 | 儲存離線消息的時長。秒為機關。最多支援10天(864000秒)。 0 表示該消息不儲存離線。即:使用者線上馬上發出,目前不線上使用者将不會收到此消息。 此參數不設定則表示預設,預設為儲存1天的離線消息(86400秒)。 |
DeviceEnum | Enum | 指定的裝置。 可選值:DeviceEnum.Android, DeviceEnum.IOS。 不填或者null值為同時支援 Android 與 iOS。 |
發送消息
JPushClient公共方法
方法名稱 | 參數清單(必須) | 方法說明 |
---|---|---|
setEnableSSL | boolean enableSSL (true為使用ssl, 預設為不使用ssl) | 是否啟動ssl安全連接配接 |
sendNotificationWithImei | int sendNo(發送編号), String imei (IMEI字元串) , String msgTitle (消息标題/通知标題) , String msgContent (消息内容/通知内容) | 發送帶IMEI的通知 |
int sendNo , String imei , String msgTitle , String msgContent , int builderId (自定義通知欄樣式Id) , Map<String, Object>extra (附屬資訊) | 自定義通知欄(沒有則填寫0) 以及傳遞附屬資訊 | |
sendCustomMessageWithImei | String msgContent | 發送帶IMEI的消息 |
String msgContent, String msgContentType (消息内容類型,原樣傳回), Map<String, Object> extra | 使用者自定義消息類型, | |
sendNotificationWithTag | String tag (Tag字元串) , String msgContent | 發送帶Tag的通知 |
String tag , String msgContent , int builderId , Map<String, Object>extra | ||
sendCustomMessageWithTag | 發送帶Tag的消息 | |
String msgContent , String msgContentType , | ||
sendNotificationWithAlias | String alias (Alias字元串) , String msgTitle , | 發送帶Alias的通知 |
sendCustomMessageWithAlias | String alias , | 發送帶Alias的消息 |
sendNotificationWithAppKey | 發送通知給AppKey的所有使用者 | |
sendCustomMessageWithAppKey | 發送帶AppKey的消息 | |
Map<String, Object> extra |
代碼示例
代碼示例-發送帶IMEI的通知
|
代碼示例-IOS設定通知鈴聲和badge
|
MessageResult 類
公共方法 | 方法用途 |
---|---|
消息發送成功後,按用戶端傳輸的sendNo原樣傳回 | |
錯誤代碼,代碼定義參考ErrorCodeEnum | |
getErrmsg | 傳回錯誤消息的描述 |
ErrorCode 類
錯誤代碼-ErrorCodeEnum
|