README-CN.md

March 17, 2025 · View on GitHub

Jiguang.JPush.Extensions 是一个 JPush 扩展类库,方便你在 .Net Standard 2.0+ 中更方便地使用 JPush 。

支持的平台

  • .Net Standard 2.0+

安装

Nuget package

使用方法

Startup.ConfigureServices 中添加 JPush:

services.AddJPush(options =>
{
    options.AppKey = "Your AppKey";
    options.MasterSecret = "Your MasterSecret";
});

或者,也可以通过配置文件添加:

var configuration = new ConfigurationBuilder()
    .AddJsonFile("随便什么名.json")
    .Build();
services.AddJPush(configuration);

然后在 json 文件中添加如下数据:

{
  "AppKey": "Your AppKey",
  "MasterSecret": "Your MasterSecret"
}

您还可以直接调用 AddJPush() 而不传递任何参数,这样做需要在 Startup.ConfigureServices 方法中使用 services.Configure<JPushOptions>(configuration) 来配置 JPushOptions

然后,就可以愉快的使用 JPush 了😝。

private readonly JPushClient _client;

public Constructor(JPushClient client)
{
    _client = client;
}

注意事项

  • 程序包版本v1.1.0对应 Jiguang.Jpush 的v1.1.0版本,以此类推。
  • 新版本 Jiguang.JPush 将由Azure Pipelines每月自动发布。
  • 若有某个版本未被实现,请提issue或直接联系我本人。