By going to gdrive, I tried to download the csv file programmatically. But it gives an error in service.
public class Gdriveactivity extends Activity implements ConnectionCallbacks, OnConnectionFailedListener { private static final String TAG = "android-drive-quickstart"; private static final int REQUEST_CODE_CAPTURE_IMAGE = 1; private static final int REQUEST_CODE_CREATOR = 2; private static final int REQUEST_CODE_RESOLUTION = 3; private GoogleApiClient mGoogleApiClient; private Bitmap mBitmapToSave; private void saveFiletoDrive() { ResultCallback<DriveApi.ContentsResult> contentsCallback = new ResultCallback<DriveApi.ContentsResult>() { @Override public void onResult(DriveApi.ContentsResult result) { MetadataChangeSet changeSet = new MetadataChangeSet.Builder() .setTitle("New file") .setMimeType("text/plain").build(); Drive.DriveApi.getRootFolder(mGoogleApiClient) .createFile(mGoogleApiClient, changeSet, null ) .setResultCallback(this); } }; } @Override protected void onResume() { super.onResume(); if (mGoogleApiClient == null) {
After connecting only to the gdrive account, I tried to upload the file. But this shows a maintenance error. I cannot use the Drive service to initialize either, because I imported the drive as gms
import com.google.android.gms.drive.Drive; import com.google.api.client.http.FileContent; import com.google.api.services.drive.model.File; import com.google.api.services.drive.model.ParentReference;
source share