English | 中文
C#示例代码对华为推送服务(HUAWEI Push Kit)服务端接口进行封装,包含丰富的示例程序,方便您参考或直接使用。 示例代码中的文件夹如下:
文件夹 | 说明 |
---|---|
AGConnectAdmin | 对推送服务封装的类库 |
AGConnectAdmin.Examples | 类库使用示例 |
示例代码中的主要的类定义如下:
类名 | 说明 |
---|---|
AppOptions | 应用相关配置 |
AGConnectApp | 应用 |
AGConnectMessaging | 推送服务相关接口的调用方法 |
Message | 消息体 |
以下描述了AppOptions类的相关参数。
参数 | 说明 |
---|---|
ClientId | 应用ID,从应用信息中获取 |
ClientSecret | 应用访问密钥,从应用信息中获取 |
LoginUri | 华为OAuth 2.0获取token的地址。具体请参考基于OAuth 2.0开放鉴权-客户端模式。 |
ApiBaseUri | 推送服务的访问地址。具体请参考推送服务-下行消息。 |
示例代码工程需要使用Visual Studio 2017或以上版本的开发工具打开,类库提供以下种框架版本:
AGConnectAdmin.Examples提供所有示例代码及相应功能。
AGConnectAdmin.Examples/Example.SendDataMessage.cs
AGConnectAdmin.Examples/Example.SendAndroidMessage.cs
AGConnectAdmin.Examples/Example.SendTopicMessage.cs
AGConnectAdmin.Examples/Example.SendConditionMessage.cs
AGConnectAdmin.Examples/Example.SendInstanceAppMessage.cs
AGConnectAdmin.Examples/Example.SendWebpushMessage.cs
AGConnectAdmin.Examples/Example.SendApnsMessage.cs
AGConnectAdmin.Examples/Example.SendTestMessage.cs
如果您对HMS Core还处于评估阶段,可在Reddit社区获取关于HMS Core的最新讯息,并与其他开发者交流见解。
如果您对使用HMS示例代码有疑问,请尝试:
huawei-mobile-services
标签下提问,有华为研发专家在线一对一解决您的问题。如果您在尝试示例代码中遇到问题,请向仓库提交issue,也欢迎您提交Pull Request。
华为推送服务C#示例代码经过Apache License, version 2.0授权许可.
Sign in to post a comment
Comment ( 0 )