title: Google drive android API Demos do not work correctly
body: <p>I have been pulling my hair out with this issue for quite awhile now. I want to upload my sqlite DB to Google drive and then also download it. The problem is that the Drive Demo I found <a href="https://github.com/googledrive/android-demos" rel="noreferrer">here</a> does not work. I need to get the DriveId and I do not know how, because the example application does not work. I want to <code>Create a file in a folder</code>. If there is any working tutorial, or step by step that I can use it will be greatly appreciated. I really need some help with getting this to work. </p>
  
  <p>Just for clarification, this is what I want:</p>
  
  <p>Can anyone tell me how to get the DriveId so that I can get the demo app to work? If this is impossible, is there any step by step tutorial that can help me to achieve uploading / downloading a file in a folder? Please let me know if you need anything</p>
  
  <p>This is the <code>CreateFileInFolderActivity.class</code>:</p>
  
  <pre><code>public class CreateFileInFolderActivity extends BaseDemoActivity {
  
      private DriveId mFolderDriveId;
  
      @Override
      public void onConnected(Bundle connectionHint) {
          super.onConnected(connectionHint);
          Drive.DriveApi.fetchDriveId(getGoogleApiClient(), EXISTING_FOLDER_ID)
                  .setResultCallback(idCallback);
      }
  
      final private ResultCallback&lt;DriveIdResult&gt; idCallback = new ResultCallback&lt;DriveIdResult&gt;() {
          @Override
          public void onResult(DriveIdResult result) {
              if (!result.getStatus().isSuccess()) {
                  showMessage("Cannot find DriveId. Are you authorized to view this file?");
                  return;
              }
              mFolderDriveId = result.getDriveId();
              Drive.DriveApi.newContents(getGoogleApiClient())
                      .setResultCallback(contentsResult);
          }
      };
  
      final private ResultCallback&lt;ContentsResult&gt; contentsResult = new
              ResultCallback&lt;ContentsResult&gt;() {
          @Override
          public void onResult(ContentsResult result) {
              if (!result.getStatus().isSuccess()) {
                  showMessage("Error while trying to create new file contents");
                  return;
              }
              DriveFolder folder = Drive.DriveApi.getFolder(getGoogleApiClient(), mFolderDriveId);
              MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
                      .setTitle("New file")
                      .setMimeType("text/plain")
                      .setStarred(true).build();
              folder.createFile(getGoogleApiClient(), changeSet, result.getContents())
                      .setResultCallback(fileCallback);
          }
      };
  
      final private ResultCallback&lt;DriveFileResult&gt; fileCallback = new
              ResultCallback&lt;DriveFileResult&gt;() {
          @Override
          public void onResult(DriveFileResult result) {
              if (!result.getStatus().isSuccess()) {
                  showMessage("Error while trying to create the file");
                  return;
              }
              showMessage("Created a file: " + result.getDriveFile().getDriveId());
          }
      };
  }
  </code></pre>
  
  <p>This is the <code>BaseDemoActivity.class</code>:</p>
  
  <pre><code>package com.google.android.gms.drive.sample.demo;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.content.IntentSender.SendIntentException;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.Toast;
  
  import com.google.android.gms.common.ConnectionResult;
  import com.google.android.gms.common.GooglePlayServicesUtil;
  import com.google.android.gms.common.api.GoogleApiClient;
  import com.google.android.gms.drive.Drive;
  
  /**
  * An abstract activity that handles authorization and connection to the Drive
  * services.
  */
  public abstract class BaseDemoActivity extends Activity implements
          GoogleApiClient.ConnectionCallbacks,
          GoogleApiClient.OnConnectionFailedListener {
  
      private static final String TAG = "BaseDriveActivity";
  
      /**
       * DriveId of an existing folder to be used as a parent folder in
       * folder operations samples.
       * Existing folder ID = CAESHDBCN2RKT1FUNnYzMWlkWE5VUzJKcVNuWXdVRGcYNiCGvM3xolE= and it
       * does not work
       */
      public static final String EXISTING_FOLDER_ID = "jqatpab1jsujpum14p7cq41pbtiij32q";
  
      /**
       * DriveId of an existing file to be used in file operation samples..
       */
      public static final String EXISTING_FILE_ID = "0ByfSjdPVs9MZTHBmMVdSeWxaNTg";
  
      /**
       * Extra for account name.
       */
      protected static final String EXTRA_ACCOUNT_NAME = "account_name";
  
     /**
       * Request code for auto Google Play Services error resolution.
       */
      protected static final int REQUEST_CODE_RESOLUTION = 1;
  
      /**
       * Next available request code.
       */
      protected static final int NEXT_AVAILABLE_REQUEST_CODE = 2;
  
      /**
       * Google API client.
       */
      private GoogleApiClient mGoogleApiClient;
  
      /**
       * Called when activity gets visible. A connection to Drive services need to
       * be initiated as soon as the activity is visible. Registers
       * {@code ConnectionCallbacks} and {@code OnConnectionFailedListener} on the
       * activities itself.
       */
      @Override
      protected void onResume() {
          super.onResume();
          if (mGoogleApiClient == null) {
              mGoogleApiClient = new GoogleApiClient.Builder(this)
                      .addApi(Drive.API)
                      .addScope(Drive.SCOPE_FILE)
                      .addScope(Drive.SCOPE_APPFOLDER) // required for App Folder sample
                      .addConnectionCallbacks(this)
                      .addOnConnectionFailedListener(this)
                      .build();
          }
          mGoogleApiClient.connect();
      }
  
      /**
       * Handles resolution callbacks.
       */
      @Override
      protected void onActivityResult(int requestCode, int resultCode,
              Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode == REQUEST_CODE_RESOLUTION &amp;&amp; resultCode == RESULT_OK) {
              mGoogleApiClient.connect();
          }
      }
  
      /**
       * Called when activity gets invisible. Connection to Drive service needs to
       * be disconnected as soon as an activity is invisible.
       */
      @Override
      protected void onPause() {
          if (mGoogleApiClient != null) {
              mGoogleApiClient.disconnect();
          }
          super.onPause();
      }
  
      /**
       * Called when {@code mGoogleApiClient} is connected.
       */
      @Override
      public void onConnected(Bundle connectionHint) {
          Log.i(TAG, "GoogleApiClient connected");
      }
  
      /**
       * Called when {@code mGoogleApiClient} is disconnected.
       */
      @Override
      public void onConnectionSuspended(int cause) {
          Log.i(TAG, "GoogleApiClient connection suspended");
      }
  
      /**
       * Called when {@code mGoogleApiClient} is trying to connect but failed.
       * Handle {@code result.getResolution()} if there is a resolution is
       * available.
       */
      @Override
      public void onConnectionFailed(ConnectionResult result) {
          Log.i(TAG, "GoogleApiClient connection failed: " + result.toString());
          if (!result.hasResolution()) {
              // show the localized error dialog.
              GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this, 0).show();
              return;
          }
          try {
              result.startResolutionForResult(this, REQUEST_CODE_RESOLUTION);
          } catch (SendIntentException e) {
              Log.e(TAG, "Exception while starting resolution activity", e);
          }
      }
  
      /**
       * Shows a toast message.
       */
      public void showMessage(String message) {
          Toast.makeText(this, message, Toast.LENGTH_LONG).show();
      }
  
      /**
       * Getter for the {@code GoogleApiClient}.
       */
      public GoogleApiClient getGoogleApiClient() {
        return mGoogleApiClient;
      }
  }
  </code></pre>
  
  <p>Thank you in advance.</p>