# hms-push-serverdemo-java **Repository Path**: misery-of-the-waning-moon/hms-push-serverdemo-java ## Basic Information - **Project Name**: hms-push-serverdemo-java - **Description**: 华为推送服务服务端Java示例代码,对华为推送的服务端接口进行封装,包含丰富的示例程序,方便您参考或直接使用。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 18 - **Created**: 2023-09-03 - **Last Updated**: 2023-09-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # HMS Pushkit Java Severdemo English | [中文](https://gitee.com/hms-core/hms-push-serverdemo-java/blob/master/README_ZH.md) ## Table of Contents * [Introduction](#introduction) * [Supported Environments](#supported-environments) * [Installation](#installation) * [Configuration ](#configuration ) * [Sample Code](#sample-code) * [Technical Support](#technical-support) * [License](#license) ## Introduction Java sample code encapsulates APIs of the HUAWEI Push Kit server. It provides many sample programs for your reference or usage. The following table describes packages of Java sample code. | Package | Description | | ---- | ---- | | examples | Sample code packages. Each package can run independently. | | messaging | Package where APIs of the HUAWEI Push Kit server are encapsulated. | ## Supported Environments For HUAWEI Push Kit, JDK 8.0 or later and IntelliJ IDEA are recommended. ## Installation Configure your build tool to import the sample code into your IDE. ## Configuration The following table lists parameters to be set. | Parameter | Description | | ---- | ---- | | appid | App ID, which is obtained from app information. | | appsecret | Secret access key of an app, which is obtained from app information. | | token_server | URL for the Huawei OAuth 2.0 service to obtain a token, please refer to [Generating an App-Level Access Token](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/oauth2-0000001212610981). | | push_open_url | URL for accessing HUAWEI Push Kit, please refer to [Sending Messages](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 If you want to evaluate more about HMS Core, [r/HMSCore on Reddit](https://www.reddit.com/r/HuaweiDevelopers/) is for you to keep up with latest news about HMS Core, and to exchange insights with other developers. If you have questions about how to use HMS samples, try the following options: - [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services) is the best place for any programming questions. Be sure to tag your question with `huawei-mobile-services`. - [Huawei Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001) HMS Core Module is great for general questions, or seeking recommendations and opinions. If you run into a bug in our samples, please submit an [issue](https://github.com/HMS-Core/hms-push-serverdemo-java/issues) to the Repository. Even better you can submit a [Pull Request](https://github.com/HMS-Core/hms-push-serverdemo-java/pulls) with a fix. ## License Pushkit Java sample is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).