Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Drive Android API tutorial issue

Following this tutorial, I pasted this code into my Main Activity:

@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
    if (connectionResult.hasResolution()) {
        try {
            connectionResult.startResolutionForResult(this, RESOLVE_CONNECTION_REQUEST_CODE);
        } catch (IntentSender.SendIntentException e) {
            // Unable to resolve, message user appropriately
        }
    } else {
        GooglePlayServicesUtil.getErrorDialog(connectionResult.getErrorCode(), this, 0).show();
    }
}

I end up having to import a buncha libraries, but I still can't fix this error:

RESOLVE_CONNECTION_REQUEST_CODE cannot be resolved to a variable

any ideas??? I can't figure out which library contains this constant...

like image 398
woojoo666 Avatar asked Jun 26 '14 00:06

woojoo666


People also ask

Why isn't Google Drive working on Android?

Update or reinstall Google Drive. If it still has the issue, you can attempt to remove the app from your device and reinstall it. Or upgrade it to the latest version, especially after you updated the Android OS. What's more, you'd better reinstall it from the Play Store instead of third-party sources.

How do I fix Error 403 user limit exceeded?

Resolve a 403 error: User rate limit exceeded To fix this error, try to optimize your application code to make fewer requests or retry requests. For information on retrying requests, refer to Retry failed requests to resolve errors. For additional information on Gmail limits, refer to Usage limits.


1 Answers

Turns out when the tutorial specifies to start with an android project, they mean a Google Drive android project, which has different imports and class definitions, which aren't made clear from the tutorial. They actually give some starter code for a Google Drive android project, but they mislabeled it as just a "Android Quickstart" so I assumed it was no different from any other android project.

enter image description here

Here's where the link goes: Google Drive Android Quickstart, and the tutorial makes alot more sense if you use this code as a reference.

If anybody is curious what the fix to the original issue is, the constant should actually be REQUEST_CODE_RESOLUTION, but again, there are alot more changes so just use the Google Drive Android Quickstart

like image 187
woojoo666 Avatar answered Sep 22 '22 12:09

woojoo666