Problem with Google API for Google Drive

Following this tutorial , I introduced 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 need to import buncha libraries, but I still cannot 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 ...

+8
android google-drive-android-api
source share
1 answer

It turns out that when the tutorial points to the launch of the android project, it means the Google Android android project, which has different imports and class definitions that are not described in the tutorial. They do provide some starting code for the Google Android project for Android, but they incorrectly designated it as “Android Quickstart”, so I assumed that it is no different from any other Android project.

enter image description here

Here's where the link goes: Quick launch of Google Drive Android , and the tutorial makes much more sense if you use this code as a link.

If someone is interested in what is fixing the original problem, the constant should actually be REQUEST_CODE_RESOLUTION , but again, there are a lot of changes, so just use the Quick Launch Google Drive Android drive

+12
source share

All Articles