{"id":22441349,"url":"https://github.com/hms-core/hms-push-serverdemo-csharp","last_synced_at":"2025-07-10T19:02:43.860Z","repository":{"id":37690725,"uuid":"266916637","full_name":"HMS-Core/hms-push-serverdemo-csharp","owner":"HMS-Core","description":"C# sample code encapsulates APIs of the HUAWEI Push Kit server. It provides many sample programs for your reference or usage. ","archived":false,"fork":false,"pushed_at":"2024-02-19T09:07:55.000Z","size":150,"stargazers_count":32,"open_issues_count":7,"forks_count":18,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-08T05:44:14.854Z","etag":null,"topics":["csharp","hms","huawei","push","push-notifications","sendmessage"],"latest_commit_sha":null,"homepage":"https://developer.huawei.com/consumer/cn/doc/development/HMS-Guides/push-introduction","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HMS-Core.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-05-26T01:32:59.000Z","updated_at":"2024-06-20T01:01:40.000Z","dependencies_parsed_at":"2023-01-25T07:15:46.210Z","dependency_job_id":"c852a407-b260-4d5b-8358-875e889c4d23","html_url":"https://github.com/HMS-Core/hms-push-serverdemo-csharp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HMS-Core/hms-push-serverdemo-csharp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-push-serverdemo-csharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-push-serverdemo-csharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-push-serverdemo-csharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-push-serverdemo-csharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HMS-Core","download_url":"https://codeload.github.com/HMS-Core/hms-push-serverdemo-csharp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-push-serverdemo-csharp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264637898,"owners_count":23642070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","hms","huawei","push","push-notifications","sendmessage"],"created_at":"2024-12-06T02:14:13.458Z","updated_at":"2025-07-10T19:02:43.822Z","avatar_url":"https://github.com/HMS-Core.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HMS Core Push Kit Sample Code (C#)\nEnglish | [中文](README_ZH.md)\n## Contents\n * [Introduction](#Introduction)\n * [Installation](#Installation)\n * [Configuration](#Configuration)\n * [Environment Requirements](#Environment-Requirements)\n * [Sample Code](#Sample-Code)\n * [Technical Support](#technical-support)\n * [License](#License)\n\n## Introduction\n\nThe sample code for C# encapsulates the server-side APIs of Push Kit, for your reference or direct use.\n\nThe following table describes folders of C# sample code.\n| Folder| Description|\n| ------------ | ----------- |\n|AGConnectAdmin|Class library where Push Kit server APIs are encapsulated.|\n|AGConnectAdmin.Examples|Class library usage examples.|\n\nThe following table describes main classes used in the sample code.\n| Class Name| Description|\n| ----------- | ----------- |\n|AppOptions|App-related configuration.|\n|AGConnectApp|App.|\n|AGConnectMessaging|Push Kit API calling methods.|\n|Message|Message body.|\n\n## Installation\n\n1. Decompress the sample code.\n2. Copy **AGConnectAdmin** to a proper position in your Visual Studio solution and reference the corresponding assembly in your project.\n3. Use the classes in **AGConnectAdmin** by referring to the sample code.\n\n## Configuration\n\nThe following table describes the parameters related to the **AppOptions** class.\n\n| Parameter| Description|\n| ----------- | ----------- |\n|ClientId|App ID, which is obtained from the app information.|\n|ClientSecret|App secret, which is obtained from the app information.|\n|LoginUri|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).|\n|ApiBaseUri|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).|\n\n## Environment Requirements\n\nThe demo projects need to be opened using Visual Studio 2017 or a later version. The following framework versions are supported:\n\n- .NET Framework 4.5 or later\n- .NET Standard 2.0 or later\n\n## Sample Code\n\n**AGConnectAdmin.Examples** provides all sample code and corresponding functions.\n\n1. Send an Android data message. Code location: [SendDataMessage.cs](src/AGConnectAdmin.Examples/Example.SendDataMessage.cs)\n\n2. Send an Android notification message. Code location: [SendAndroidMessage.cs](src/AGConnectAdmin.Examples/Example.SendAndroidMessage.cs)\n\n3. Send a message by topic.Code location: [SendTopicMessage.cs](src/AGConnectAdmin.Examples/Example.SendTopicMessage.cs)\n\n4. Send a message by conditions. Code location: [SendConditionMessage.cs](src/AGConnectAdmin.Examples/Example.SendConditionMessage.cs)\n\n5. Send a message to a Huawei quick app. Code location: [SendInstanceAppMessage.cs](src/AGConnectAdmin.Examples/Example.SendInstanceAppMessage.cs)\n\n6. Send a message through the WebPush agent. Code location: [SendWebpushMessage.cs](src/AGConnectAdmin.Examples/Example.SendWebpushMessage.cs)\n\n7. Send a message through the APNs agent. Code location: [SendApnsMessage.cs](src/AGConnectAdmin.Examples/Example.SendApnsMessage.cs)\n\n8. Send a test message. Code location: [SendTestMessage.cs](src/AGConnectAdmin.Examples/Example.SendTestMessage.cs)\n\n\n## Technical Support\nYou can visit the [Reddit community](https://www.reddit.com/r/HuaweiDevelopers/) to obtain the latest information about HMS Core and communicate with other developers.\n\nIf you have any questions about the sample code, try the following:\n- 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.\n- 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.\n\nIf you encounter any issues when using the sample code, submit your [issues](https://github.com/HMS-Core/hms-push-serverdemo-csharp/issues) or submit a [pull request](https://github.com/HMS-Core/hms-push-serverdemo-csharp/pulls).\n\n## License\nThe sample code is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhms-core%2Fhms-push-serverdemo-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhms-core%2Fhms-push-serverdemo-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhms-core%2Fhms-push-serverdemo-csharp/lists"}