簡體   English   中英

Class "AGConnectServicesConfig" 在 com.huawei.hms:push:5.3.0.301 中被棄用

[英]Class "AGConnectServicesConfig" is deprecated in com.huawei.hms:push:5.3.0.301

當我將 pushSDK 更新為“5.3.0.301”版本時,我發現AGConnectServicesConfig已被棄用。 我想知道它的替代品是什么。 如何在新版本中獲取 app_id? 我曾經像這樣獲得app_id:

  String appId = AGConnectServicesConfig.fromContext(context).getString("client/app_id");

更新時如何獲取?

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

嘗試這個

在此處輸入圖像描述

 String appId = new AGConnectOptionsBuilder().build(MainActivity.this).getString("client/app_id");

有關更多詳細信息,請查看文檔

我的回答是:

步驟 1:更新了依賴版本。

    implementation 'com.huawei.hms:push:6.1.0.300'
    classpath 'com.huawei.agconnect:agcp:1.6.0.300'

第 2 步:已更改。

AGConnectOptionsBuilder().build(this@MainActivity)
                    .getString("client/app_id")

它奏效了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM