I have an android app and I'm implementing share following these instructions.
I manage to get it working. I came back to it the next day and I get this output in logcat:
G+ on connection failed ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{422d8470: android.os.BinderProxy@422d8410}}
I have triple checked the api console, removed my OAuth clientID and input again fresh. This has not fixed it. Any idea about what I can look into to fix it?
There may be many reasons behind this issue, including Windows firewall and antivirus software, administrative permissions, incorrect program installation, Internet connection, etc. Before troubleshooting, you need to make sure you know how to change Google Drive sharing settings properly.
If the folder you want to share with anyone on the link is owned within a G Suite account, you need to "Set Drive users' sharing permissions" to allow all the users to share folders to non-gmail account. Note: If the folders are in a shared drive, non-Google account cannot be added to the Shared drive.
If you sync changes to a file you don't own and the owner doesn't have enough storage, the changes won't sync. To sync changes, reach out to the file owner to either transfer ownership or ask them to manage their storage. If you don't have enough local storage, free up space.
You can get the SIGN_IN_REQUIRED connection result for a number of reasons, eg.:
PlusClient.clearDefaultAccount();
.PlusClient.revokeAccessAndDisconnect();
.For SIGN_IN_REQUIRED, the ConnectionResult you receive contains a PendingIntent which can be used to resolve the issue. In the sample at the instructions you're following the example code handles the error in onConnectionFailed
with the following code:
@Override
public void onConnectionFailed(ConnectionResult result) {
if (result.hasResolution()) {
try {
result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
} catch (SendIntentException e) {
mPlusClient.connect();
}
}
// Save the result and resolve the connection failure upon a user click.
mConnectionResult = result;
}
result.startResolutionForResult()
will display an account chooser or the permissions dialog to resolve the issues mentioned above, and return control to onActivityResult
, eg:
@Override
protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
if (requestCode == REQUEST_CODE_RESOLVE_ERR && responseCode == RESULT_OK) {
mConnectionResult = null;
mPlusClient.connect();
}
}
At this point the call to PlusClient.connect()
should succeed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With