मैं पहली डेमो का उपयोग कर एपीआई एंड्रॉयड पर Google डिस्क के साथ काम करने का प्रयास करें,:एंड्रॉयड एपीआई गूगल ड्राइव "कनेक्शन विफल"
https://github.com/googledrive/android-quickstart
हालांकि, मैं इस त्रुटि है कि मैं का समाधान नहीं कर सकता है।
GoogleApiClient कनेक्शन विफल: ConnectionResult {statusCode = SIGN_IN_REQUIRED, संकल्प = PendingIntent {421d40e8: [email protected]}}
@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 मेल खाना चाहिए। एक डीवी मशीन पर चल रहे डीबग संस्करण में रिलीज संस्करण के अलग पैकेज नाम और SHA1 हो सकते हैं। – Hong