English | 中文
C# sample code encapsulates APIs of the HUAWEI Push Kit server. It provides many sample programs for your reference or usage. The following table describes folders of C# sample code:
Folder | Description |
---|---|
AGConnectAdmin | Class library encapsulated for HUAWEI Push Kit. |
AGConnectAdmin.Examples | Examples of using the Class library. |
The following table defines main classes in the sample code:
Class | Description |
---|---|
AppOptions | App configurations. |
AGConnectApp | App. |
AGConnectMessaging | HUAWEI Push Kit API calling methods. |
Message | Body of a message. |
The following table describes parameters of the AppOptions class:
Parameter | Description |
---|---|
ClientId | App ID, which is obtained from app information. |
ClientSecret | Secret access key of an app, which is obtained from app information. |
LoginUri | URL for the Huawei OAuth 2.0 service to obtain a token, please refer to Generating an App-Level Access Token. |
ApiBaseUri | URL for accessing HUAWEI Push Kit, please refer to Sending Messages. |
Sample code projects need to be opened by Visual Studio 2017 or a later version and supports the following frameworks:
All sample code are in AGConnectAdmin.Examples project included below use cases.
Send an Android data message. Code location: SendDataMessage.cs
Send an Android notification message. Code location: SendAndroidMessage.cs
Send a message by topic.Code location: SendTopicMessage.cs
Send a message by conditions. Code location: SendConditionMessage.cs
Send a message to a Huawei quick app. Code location: SendInstanceAppMessage.cs
Send a message through the WebPush agent. Code location: SendWebpushMessage.cs
Send a message through the APNs agent. Code location: SendApnsMessage.cs
Send a test message. Code location: SendTestMessage.cs
If you want to evaluate more about HMS Core, r/HMSCore on Reddit 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:
huawei-mobile-services
.If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.
Pushkit Csharp sample codes are licensed under the Apache License, version 2.0.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。