File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # 华为推送服务服务端Java示例代码
2+
3+
4+ ## 目录
5+
6+ * [ 简介] ( #简介 )
7+ * [ 环境要求] ( #环境要求 )
8+ * [ 安装] ( #安装 )
9+ * [ 配置] ( #配置 )
10+ * [ 示例代码] ( #示例代码 )
11+ * [ 授权许可] ( #授权许可 )
12+
13+
14+ ## 简介
15+
16+ Java示例代码对华为推送服务(HUAWEI Push Kit)服务端接口进行封装,包含丰富的示例程序,方便您参考或直接使用。
17+
18+ 示例代码主要包括以下组成:
19+
20+ | 包名 | 说明 |
21+ | ---- | ---- |
22+ | examples | 示例代码包,每个包都可以独立运行 |
23+ | messaging | 推送服务的服务端接口封装包 |
24+
25+ ## 环境要求
26+
27+ 推荐使用JDK 8.0及以上版本和IntelliJ IDEA。
28+
29+ ## 安装
30+ 配置好编译工具,将示例代码导入您的集成开发环境(IDE)中。
31+
32+ ## 配置
33+
34+ 请配置以下参数:
35+
36+ | 参数 | 说明 |
37+ | ---- | ---- |
38+ | appid | 应用ID,从应用信息中获取 |
39+ | appsecret | 应用访问密钥,从应用信息中获取 |
40+ | token_server | 华为OAuth 2.0获取token的地址。具体请参考 [ 基于OAuth 2.0开放鉴权-客户端模式] ( https://developer.huawei.com/consumer/cn/doc/development/parts-Guides/generating_app_level_access_token ) . |
41+ | push_open_url | 推送服务的访问地址。具体请参考 [ 推送服务-下行消息] ( https://developer.huawei.com/consumer/cn/doc/development/HMS-References/push-sendapi ) . |
42+
43+ ## 示例代码
44+
45+ #### 1. 发送Android透传消息
46+ 代码位置:examples/sendDataMessage.java
47+
48+ #### 2. 发送Android通知栏消息
49+ 代码位置:examples/sendNotifyMessage.java
50+
51+ #### 3. 基于主题发送消息
52+ 代码位置:examples/sendTopicMessage.java
53+
54+ #### 4. 基于条件发送消息
55+ 代码位置:examples/sendConditionMessage.java
56+
57+ #### 5. 向华为快应用发送消息
58+ 代码位置:examples/sendInstanceAppMessage.java
59+
60+ #### 6. 基于WebPush代理发送消息
61+ 代码位置:examples/sendWebpushMessage.java
62+
63+ #### 7. 基于APNs代理发送消息
64+ 代码位置:examples/sendApnsMessage.java
65+
66+ #### 8. 发送测试消息
67+ 代码位置:examples/sendTestMessage.java
68+
69+ ## 技术支持
70+ 如果您对HMS Core还处于评估阶段,可在[ Reddit社区] ( https://www.reddit.com/r/HuaweiDevelopers/ ) 获取关于HMS Core的最新讯息,并与其他开发者交流见解。
71+
72+ 如果您对使用HMS示例代码有疑问,请尝试:
73+ - 开发过程遇到问题上[ Stack Overflow] ( https://stackoverflow.com/questions/tagged/huawei-mobile-services ) ,在` huawei-mobile-services ` 标签下提问,有华为研发专家在线一对一解决您的问题。
74+ - 到[ 华为开发者论坛] ( https://developer.huawei.com/consumer/cn/forum/blockdisplay?fid=18 ) HMS Core板块与其他开发者进行交流。
75+
76+ 如果您在尝试示例代码中遇到问题,请向仓库提交[ issue] ( https://github.com/HMS-Core/hms-push-serverdemo-java/issues ) ,也欢迎您提交[ Pull Request] ( https://github.com/HMS-Core/hms-push-serverdemo-java/pulls ) 。
77+
78+ ## 授权许可
79+ 华为推送服务Java示例代码经过 [ Apache License, version 2.0] ( http://www.apache.org/licenses/LICENSE-2.0 ) 授权许可。
You can’t perform that action at this time.
0 commit comments