|
1 | | -# HMS Pushkit Java Severdemo |
2 | | -English | [中文](https://github.com/HMS-Core/hms-push-serverdemo-java/blob/master/README_ZH.md) |
3 | | - |
4 | | -## Table of Contents |
5 | | - |
6 | | - * [Introduction](#introduction) |
7 | | - * [Supported Environments](#supported-environments) |
8 | | - * [Installation](#installation) |
9 | | - * [Configuration ](#configuration ) |
10 | | - * [Sample Code](#sample-code) |
11 | | - * [License](#license) |
12 | | - |
13 | | - |
| 1 | +# HMS Core Push Kit Sample Code (Java) |
| 2 | +English | [中文](README_ZH.md) |
| 3 | + |
| 4 | +## Contents |
| 5 | + |
| 6 | + * [Introduction](#Introduction) |
| 7 | + * [Environment Requirements](#Environment-Requirements) |
| 8 | + * [Installation](#Installation) |
| 9 | + * [Configuration](#Configuration) |
| 10 | + * [Sample Code](#Sample-Code) |
| 11 | + * [License](#License) |
| 12 | + |
| 13 | + |
14 | 14 | ## Introduction |
15 | 15 |
|
16 | | -Java sample code encapsulates APIs of the HUAWEI Push Kit server. It provides many sample programs for your reference or usage. |
| 16 | +The sample code for Java encapsulates the server-side APIs of Push Kit, for your reference or direct use. |
17 | 17 |
|
18 | 18 | The following table describes packages of Java sample code. |
19 | | - |
20 | | -| Package | Description | |
| 19 | +| Package| Description| |
21 | 20 | | ---- | ---- | |
22 | | -| examples | Sample code packages. Each package can run independently. | |
23 | | -| messaging | Package where APIs of the HUAWEI Push Kit server are encapsulated. | |
24 | | - |
25 | | -## Supported Environments |
| 21 | +| examples| Sample code packages.| |
| 22 | +| messaging| Package where Push Kit server APIs are encapsulated.| |
26 | 23 |
|
27 | | -For HUAWEI Push Kit, JDK 8.0 or later and IntelliJ IDEA are recommended. |
| 24 | +## Environment Requirements |
28 | 25 |
|
29 | | -## Installation |
30 | | -Configure your build tool to import the sample code into your IDE. |
| 26 | +JDK 8.0 or later is recommended. |
31 | 27 |
|
32 | | -## Configuration |
| 28 | +## Configuration |
33 | 29 |
|
34 | | -The following table lists parameters to be set. |
| 30 | +Set the following parameters. |
35 | 31 |
|
36 | | -| Parameter | Description | |
| 32 | +| Parameter| Description| |
37 | 33 | | ---- | ---- | |
38 | | -| appid | App ID, which is obtained from app information. | |
39 | | -| appsecret | Secret access key of an app, which is obtained from app information. | |
40 | | -| 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/parts-Guides/generating_app_level_access_token). | |
41 | | -| push_open_url | URL for accessing HUAWEI Push Kit, please refer to [Sending Messages](https://developer.huawei.com/consumer/en/doc/development/HMS-References/push-sendapi). | |
| 34 | +| appid| App ID, which is obtained from the app information.| |
| 35 | +| appsecret | App secret, which is obtained from the app information.| |
| 36 | +| 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). | |
| 37 | +| 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). | |
42 | 38 |
|
43 | 39 | ## Sample Code |
44 | 40 |
|
45 | | -#### 1. Send an Android data message. |
46 | | -Code location: examples/sendDataMessage.java |
| 41 | +1. Send a data message to an Android app. |
| 42 | +File path: **examples/sendDataMessage.java** |
47 | 43 |
|
48 | | -#### 2. Send an Android notification message. |
49 | | -Code location: examples/sendNotifyMessage.java |
| 44 | + . Send a notification message to an Android app. |
| 45 | +File path: **examples/sendNotifyMessage.java** |
50 | 46 |
|
51 | | -#### 3. Send a message by topic. |
52 | | -Code location: examples/sendTopicMessage.java |
| 47 | + . Send a message by topic. |
| 48 | +File path: **examples/sendTopicMessage.java** |
53 | 49 |
|
54 | | -#### 4. Send a message by conditions. |
55 | | -Code location: examples/sendConditionMessage.java |
| 50 | + . Send a message by condition. |
| 51 | +File path: **examples/sendConditionMessage.java** |
56 | 52 |
|
57 | | -#### 5. Send a message to a Huawei quick app. |
58 | | -Code location: examples/sendInstanceAppMessage.java |
| 53 | + . Send a message to a Huawei quick app. |
| 54 | +File path: **examples/sendInstanceAppMessage.java** |
59 | 55 |
|
60 | | -#### 6. Send a message through the WebPush agent. |
61 | | -Code location: examples/sendWebpushMessage.java |
| 56 | + . Send a message by WebPush. |
| 57 | +File path: **examples/sendWebpushMessage.java** |
62 | 58 |
|
63 | | -#### 7. Send a message through the APNs agent. |
64 | | -Code location: examples/sendApnsMessage.java |
| 59 | + . Send a message by APNs. |
| 60 | +File path: **examples/sendApnsMessage.java** |
65 | 61 |
|
66 | | -#### 8. Send a test message. |
67 | | -Code location: examples/sendTestMessage.java |
| 62 | + . Send a test message. |
| 63 | +File path: **examples/sendTestMessage.java** |
68 | 64 |
|
69 | | -## Question or issues |
70 | | -If you want to evaluate more about HMS Core, |
71 | | -[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. |
| 65 | +## Technical Support |
| 66 | +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. |
72 | 67 |
|
73 | | -If you have questions about how to use HMS samples, try the following options: |
74 | | -- [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 |
75 | | -`huawei-mobile-services`. |
76 | | -- [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. |
| 68 | +If you have any questions about the sample code, try the following: |
| 69 | +- 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. |
| 70 | +- 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. |
77 | 71 |
|
78 | | -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. |
| 72 | +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). |
79 | 73 |
|
80 | 74 | ## License |
81 | | -Pushkit Java sample is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0). |
| 75 | +The sample code is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0). |
0 commit comments