# HMS Core Push Kit Sample Code (Java)
English | [中文](README_ZH.md)
## Contents
* [Introduction](#Introduction)
* [Environment Requirements](#Environment-Requirements)
* [Installation](#Installation)
* [Configuration](#Configuration)
* [Sample Code](#Sample-Code)
* [Technical Support](#technical-support)
* [License](#License)
## Introduction
The sample code for Java encapsulates the server-side APIs of Push Kit, for your reference or direct use.
The following table describes packages of Java sample code.
| Package| Description|
| ---- | ---- |
| examples| Sample code packages.|
| messaging| Package where Push Kit server APIs are encapsulated.|
## Environment Requirements
JDK 8.0 or later is recommended.
## Configuration
Set the following parameters.
| Parameter| Description|
| ---- | ---- |
| appid| App ID, which is obtained from the app information.|
| appsecret | App secret, which is obtained from the app information.|
| token_server | URL for Huawei OAuth 2.0 to obtain a token. For details, please refer to [OAuth 2.0-based Authentication](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/oauth2-0000001212610981?ha_source=hms1). |
| push_open_url | Access address of Push Kit. For details, please refer to [Downlink Message Sending](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-server-dev-0000001050040110?ha_source=hms1). |
## Sample Code
#### 1. Send an Android data message.
Code location: [examples/SendDataMessage.java](src/main/java/com/huawei/push/examples/SendDataMessage.java)
#### 2. Send an Android notification message.
Code location: [examples/SendNotifyMessage.java](src/main/java/com/huawei/push/examples/SendNotifyMessage.java)
#### 3. Send a message by topic.
Code location: [examples/SendTopicMessage.java](src/main/java/com/huawei/push/examples/SendTopicMessage.java)
#### 4. Send a message by conditions.
Code location: [examples/SendConditionMessage.java](src/main/java/com/huawei/push/examples/SendConditionMessage.java)
#### 5. Send a message to a Huawei quick app.
Code location: [examples/SendInstanceAppMessage.java](src/main/java/com/huawei/push/examples/SendInstanceAppMessage.java)
#### 6. Send a message through the WebPush agent.
Code location: [examples/SendWebpushMessage.java](src/main/java/com/huawei/push/examples/SendWebpushMessage.java)
#### 7. Send a message through the APNs agent.
Code location: [examples/SendApnsMessage.java](src/main/java/com/huawei/push/examples/SendApnsMessage.java)
#### 8. Send a test message.
Code location: [examples/SendTestMessage.java](src/main/java/com/huawei/push/examples/SendTestMessage.java)
## Technical Support
You can visit the [Reddit community](https://www.reddit.com/r/HuaweiDevelopers/) to obtain the latest information about HMS Core and communicate with other developers.
If you have any questions about the sample code, try the following:
- Visit [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Votes), submit your questions, and tag them with `huawei-mobile-services`. Huawei experts will answer your questions.
- Visit the HMS Core section in the [HUAWEI Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001?ha_source=hms1) and communicate with other developers.
If you encounter any issues when using the sample code, submit your [issues](https://github.com/HMS-Core/hms-push-serverdemo-java/issues) or submit a [pull request](https://github.com/HMS-Core/hms-push-serverdemo-java/pulls).
## License
The sample code is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
没有合适的资源?快使用搜索试试~ 我知道了~
华为推送demo(服务端)
共68个文件
java:55个
gitignore:6个
md:3个
需积分: 5 0 下载量 118 浏览量
2024-08-27
17:20:53
上传
评论
收藏 150KB ZIP 举报
温馨提示
主要特点: 高效可靠: 基于华为的云服务平台,确保推送消息的高效、稳定传递,减少延迟和丢失现象。 多样化推送类型: 支持文字通知、图片通知、数据消息等多种消息类型,满足不同应用场景的需求。 灵活配置: 提供详细的API接口和灵活的推送策略配置,包括目标用户选择、消息内容自定义等。 易于集成: 华为推送SDK提供了详细的集成文档和示例代码,帮助开发者快速在Android应用中集成推送功能。 开发者工具: 华为开发者平台提供了推送管理控制台,允许开发者实时监控推送状态、查看推送数据和分析用户反馈。
资源推荐
资源详情
资源评论
收起资源包目录
hms-push-serverdemo-java-master.zip (68个子文件)
hms-push-serverdemo-java-master
pom.xml 2KB
.github
ISSUE_TEMPLATE
issue-with-the-sample-code.md 917B
doc
.gitignore 15B
src
main
resources
url.properties 166B
java
com
huawei
push
message
AndroidConfig.java 6KB
Message.java 5KB
ApnsConfig.java 3KB
TopicMessage.java 2KB
WebPushConfig.java 3KB
Notification.java 3KB
TokenMessage.java 1KB
reponse
SendResponse.java 1KB
TopicListResponse.java 1KB
TopicSendResponse.java 2KB
android
Button.java 3KB
BadgeNotification.java 3KB
AndroidNotification.java 21KB
Color.java 3KB
ClickAction.java 4KB
LightSettings.java 3KB
examples
SendConditionMessage.java 4KB
SendApnsMessage.java 3KB
SendDataMessage.java 2KB
SendInstanceAppMessage.java 3KB
SendTopicMessage.java 4KB
SendTestMessage.java 4KB
SendWebpushMessage.java 3KB
SendNotifyMessage.java 5KB
messaging
HuaweiOption.java 4KB
HuaweiMessageClient.java 1KB
TokenRefresher.java 3KB
HuaweiService.java 1KB
HuaweiApp.java 9KB
HuaweiMessaging.java 6KB
ImplHuaweiTrampolines.java 2KB
HuaweiCredential.java 5KB
HuaweiThreadManager.java 3KB
ThreadManager.java 3KB
HuaweiMessageClientImpl.java 9KB
HuaweiScheduledExecutor.java 2KB
apns
ApnsHeaders.java 4KB
ApnsHmsOptions.java 2KB
Aps.java 3KB
Alert.java 5KB
model
Importance.java 1KB
Visibility.java 1KB
Urgency.java 948B
TopicOperation.java 1002B
exception
HuaweiMesssagingException.java 1KB
HuaweiException.java 1KB
webpush
WebpushHeaders.java 2KB
WebActions.java 2KB
WebNotification.java 7KB
WebHmsOptions.java 2KB
util
ValidatorUtils.java 1KB
ResponceCodeProcesser.java 3KB
CollectionUtils.java 1KB
IgnoreSSLUtils.java 3KB
InitAppUtils.java 1KB
3rd-party
.gitignore 15B
LICENSE 9KB
README_ZH.md 3KB
Third Party Open Source Software Notice.docx 77KB
dist
.gitignore 15B
build
.gitignore 15B
test
.gitignore 15B
.gitignore 15B
README.md 4KB
共 68 条
- 1
资源评论
kou|zhao
- 粉丝: 0
- 资源: 72
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功