gpt4 book ai didi

Android API 谷歌驱动器 "connection failed"

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:54:35 26 4
gpt4 key购买 nike

我尝试在 Android 上使用 API Google Drive,首先使用演示:

https://github.com/googledrive/android-quickstart

但是,我遇到了无法解决的错误。

GoogleApiClient connection failed: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{421d40e8: android.os.BinderProxy@42137f78}}

@Override
public void onConnectionFailed(ConnectionResult result) {
// Called whenever the API client fails to connect.
Log.i(TAG, "GoogleApiClient connection failed: " + result.toString());
if (!result.hasResolution()) {
// show the localized error dialog.
GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this, 0).show();
return;
}
// The failure has a resolution. Resolve it.
// Called typically when the app is not yet authorized, and an
// authorization
// dialog is displayed to the user.
try {
result.startResolutionForResult(this, REQUEST_CODE_RESOLUTION);
} catch (SendIntentException e) {
Log.e(TAG, "Exception while starting resolution activity", e);
// There was an error with the resolution intent. Try again.
mGoogleApiClient.connect();
}
}


@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
if (requestCode == REQUEST_CODE_RESOLUTION) {

if (resultCode == RESULT_OK) {
Log.i(TAG, "Error resolution success.");

// Make sure the app is not already connected or attempting to connect
if (!mGoogleApiClient.isConnecting() &&
!mGoogleApiClient.isConnected()) {
mGoogleApiClient.connect();
}

} else {
GooglePlayServicesUtil.getErrorDialog(requestCode, this, 0).show();
}

break;
}
}

最佳答案

这可能是由于开发人员的疏忽(就像我遇到的那样)——您在控制台上提供的 SHA1 详细信息是生产 key 的详细信息,并且您正在 Debug模式下进行测试(SHA1 详细信息会有所不同)。错误消息 google drive API,给出的可能会更好!

关于Android API 谷歌驱动器 "connection failed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27042649/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com