谷歌+1按钮错误在Android应用程序上有一个临时的

2022-09-04 04:34:48

我通过本指南在我的应用程序中添加了谷歌加一个按钮 https://developers.google.com/+/mobile/android/recommend

当我按下按钮时,我看到谷歌加窗口,之后该窗口收到我的谷歌加帐户名称,我收到错误消息“您的+1有临时问题。请重试”

在安卓显示器中,我得到

10-14 19:05:42.466 2107-2470/com.google.android.gms.persistent W/GLSUser: [DeviceKeyStore] Cannot load key: Device key file not found.
10-14 19:05:42.872 2421-3058/com.google.android.gms E/Volley: [162] BasicNetwork.performRequest: Unexpected response code 503 for https://www.googleapis.com/pos/v1/plusones/https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.facebook.katana?abtk=&cdx=c89&container=http%3A%2F%2FD1Xfy1LMHWn3O%252FW%252BIyo6pO5l5Yo%253D.apps.googleusercontent.com%2F%3Fpkg%3Dcom.bestvpn.hotvpn%26api_key%3DAIzaSyBa9bgzwtnGchlkux96-c5Q_fi19fE1pEA&source=native%3Aandroid_app

来自 logcat 中链接的答案

{
 "kind": "pos#plusones",
 "id": "https://play.google.com/store/apps/details?id=com.facebook.katana",
 "isSetByViewer": false,
 "metadata": {
  "type": "URL",
  "globalCounts": {
   "count": 0.0
  }
 },
 "abtk": ""
}

四小时前,我在开发人员控制台中打开了Google plus API。

有人可以帮我吗?也许我忘了在任何地方检查API。在google-services.json中签到,也许是因为我正在从模拟器测试它。现在无法在真实设备中测试


答案 1

我已经在Google问题跟踪器上报告了该问题,并且他们已经将其关闭为不会修复,并指出它已被弃用

https://issuetracker.google.com/issues/73993857


答案 2

请使用以下代码:

mPlusOneButton.setOnPlusOneClickListener(new OnPlusOneClickListener() {

    @Override
    public void onPlusOneClick(Intent intent) {
        if(!plusClient.isConnected()) {
            plusClient.connect();
        } else {
            startActivityForResult(intent, 0);
        }
    }

}

并另请参阅 中的此活动以供参考:android-sdk

androidsdk/extras/google/google_play_services/samples/plus/src/com/google/android/gms/samples/plus/PlusOneActivity.java

推荐