com.huawei.hms:push:5.3.0.301 中的“AGConnectServicesConfig”类已弃用

Sha*_*elf 3 android push-notification kotlin huawei-mobile-services huawei-push-notification

当我将 pushSDK 更新到版本“5.3.0.301”时,我发现AGConnectServicesConfig它已被弃用。我想知道它的替代品是什么。如何在新版本中获取 app_id?我曾经像这样获得 app_id:

  String appId = AGConnectServicesConfig.fromContext(context).getString("client/app_id");
Run Code Online (Sandbox Code Playgroud)

更新时如何获取?

我找到了源代码,但我找不到任何替代品。

shi*_*ley 6

尝试这个

在此处输入图片说明

 String appId = new AGConnectOptionsBuilder().build(MainActivity.this).getString("client/app_id");
Run Code Online (Sandbox Code Playgroud)

有关更多详细信息,请查看文档