I am trying to embed Google Drive in my Android application and I can’t even connect to the Api client. And I do not know why:
- I configured the project and credentials in the developer console for ~ / .android / debug.keystore (the values seem to be correct)
- I have copied code from Drive for Android documentation → In the
onConnectionFailed() method, I call connectionResult.startResolutionForResult() if connectionResult.hasResolution() - In
onActivityResult for matching requestCode I get resultCode == 0 (RESULT_CANCELLED) even when I select my account
Do you have any idea why? I also tried adding:
<meta-data android:name="com.google.android.apps.drive.APP_ID" android:value="----"/>
in a manifest that is not listed on the documentation page, but on some SO posts.
thanks for the help
Edit:
I also tried using enableAutoManage
mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(Drive.API) .addScope(Drive.SCOPE_FILE) .build();
instead of manually setting up connections and connections. Invalid callbacks:
.addConnectionCallbacks(this) .addOnConnectionFailedListener(this)
It returns me error code 13 in onConnectionFailed . Based on the documentation, it seems like this is returned when:
OnConnectionFailedListener passed to enableAutoManage (FragmentActivity, GoogleApiClient.OnConnectionFailedListener) when the user does not choose to execute the resolution provided. For example, by canceling the dialog.
But I did not cancel it.
I am testing it on Nexus 5x - Android N
source share