JPush極光推送Java伺服器端例項

2021-08-07 05:45:35 字數 4163 閱讀 1254

1

import

cn.jpush.api.jpushclient;

2import

cn.jpush.api.common.resp.apiconnectionexception;

3import

cn.jpush.api.common.resp.apirequestexception;

4import

cn.jpush.api.push.pushresult;

5import

cn.jpush.api.push.model.message;

6import

cn.jpush.api.push.model.options;

7import

cn.jpush.api.push.model.platform;

8import

cn.jpush.api.push.model.pushpayload;

9import

cn.jpush.api.push.model.audience.audience;

10import cn.jpush.api.push.model.notification.*;

1112

13public

class

jpushclientutil

40 } catch

(apiconnectionexception e) catch

(apirequestexception e)

4647

return

result;48}

4950

/**51

* 傳送給所有安卓使用者

52*

@param

notification_title 通知內容標題

53*

@param

msg_title 訊息內容標題

54*

@param

msg_content 訊息內容

55*

@param

extrasparam 擴充套件字段

56*

@return

0推送失敗,1推送成功

57*/

58public

static

intsendtoallandroid( string notification_title, string msg_title, string msg_content, string extrasparam)

68 } catch

(exception e)

7273

return

result;74}

7576

/**77

* 傳送給所有ios使用者

78*

@param

notification_title 通知內容標題

79*

@param

msg_title 訊息內容標題

80*

@param

msg_content 訊息內容

81*

@param

extrasparam 擴充套件字段

82*

@return

0推送失敗,1推送成功

83*/

84public

static

intsendtoallios(string notification_title, string msg_title, string msg_content, string extrasparam)

94 } catch

(exception e)

9899

return

result;

100}

101102

/**103

* 傳送給所有使用者

104*

@param

notification_title 通知內容標題

105*

@param

msg_title 訊息內容標題

106*

@param

msg_content 訊息內容

107*

@param

extrasparam 擴充套件字段

108*

@return

0推送失敗,1推送成功

109*/

110public

static

intsendtoall( string notification_title, string msg_title, string msg_content, string extrasparam)

120 } catch

(exception e)

124125

return

result;

126}

127128

129130

public

static

pushpayload buildpushobject_android_and_ios(string notification_title, string msg_title, string msg_content, string extrasparam)

181182

private

static

pushpayload buildpushobject_all_registrationid_alertwithtitle(string registrationid,string notification_title, string msg_title, string msg_content, string extrasparam)

250251

private

static

pushpayload buildpushobject_android_all_alertwithtitle(string notification_title, string msg_title, string msg_content, string extrasparam)

288289

private

static

pushpayload buildpushobject_ios_all_alertwithtitle( string notification_title, string msg_title, string msg_content, string extrasparam)

335336

//public static void main(string args)

340//

}341

}342

343344

345public

class

jdpush catch

(apiconnectionexception e) catch

(apirequestexception e)

391}

392393

public

static

pushpayload buildpushobject_all_all_alert()

396397

public

static

pushpayload buildpushobject_all_alias_alert()

404405

public

static

pushpayload buildpushobject_android_tag_alertwithtitle()

412413

public

static

pushpayload buildpushobject_android_and_ios()

427428

public

static

pushpayload buildpushobject_ios_tagand_alertwithextrasandmessage()

446447

public

static

pushpayload buildpushobject_ios_audiencemore_messagewithextras()

460 }

極光推送Jpush

這幾天研究極光推送,發現挺好玩的 乙個jpush極光推送遠端呼叫api簡單的例項,php伺服器,貼上 文件參考 send.php include jpush.php n title 極光推送title n content 極光推送message mastersecret xx sendno 1234...

JPush極光推送

推送即伺服器給客戶端傳送通知訊息 package org.mobiletrain.a9 1jpush xmlns android android name cn.jpush.android.ui.popwinactivity android exported false android theme ...

極光推送(JPush)官方文件

本文匹配的 sdk版本 r1.2.5 以後。檢視最近更新了解最新的sdk更新情況。極光推送 jpush 是乙個端到端的推送服務,使得伺服器端訊息能夠及時地推送到終端使用者手機上,讓開發者積極地保持與使用者的連線,從而提高使用者活躍度 提高應用的留存率。極光推送客戶端支援 android,ios 兩個...