Can't access a Google Drive file from within Android when I uploaded it first via browser
<p>Im using the Drive.DriveApi in Android. Exporting and then Importing a file from within my Android App to Google Drive works in both directions. </p>

<p>I can also access the file and download it from a Web browser to my local Mac.</p>

<p>However if I first upload a new file to Google Drive with my Mac and then later try to access this file from my Android App and Import it, I can't access the file. I can see the file, but it is greyed out.</p>

<p>Im using the same user both on the Android App as online on my Mac with Google Drive.</p>

<p>Anyone?</p>

<p>My code I use. 
Import:</p>

<pre><code>        IntentSender intentSender = Drive.DriveApi
                .newOpenFileActivityBuilder()
                .setMimeType(new String[]{"application/csv"})
                .build(activity.getGoogleClient());
        try {
            activity.startIntentSenderForResult(intentSender, DRIVE_REQUEST_CODE_OPENER_IMPORT, null, 0, 0, 0);
        } catch (IntentSender.SendIntentException e) {
            Log.w(TAG, "Unable to send intent: ", e);
        }
</code></pre>

<p>Export:</p>

<pre><code>        Drive.DriveApi.newDriveContents(activity.getGoogleClient()).setResultCallback(new ResultCallback&lt;DriveApi.DriveContentsResult&gt;() {
            @Override
            public void onResult(DriveApi.DriveContentsResult driveContentsResult) {
                Uri csvUri = Uri.parse("file://" + getCsvFile(context));
                File csvFile = new File(csvUri.getPath());
                if(csvFile.length() &lt;= 0) {
                    Log.e(TAG, "File empty: " + getCsvFile(context));
                }
                FileInputStream csvInputStream = null;
                try {
                    csvInputStream  = new FileInputStream(csvFile);
                    OutputStream outputStream = driveContentsResult.getDriveContents().getOutputStream();
                    byte[] dataArray = IOUtils.toByteArray(csvInputStream);
                    outputStream.write(dataArray);
                } catch (FileNotFoundException fnfe) {
                    Log.e(TAG, "File not found: ", fnfe);
                } catch (IOException ie) {
                    Log.e(TAG, "Error uploading file: ", ie);
                }
                MetadataChangeSet metadataChangeSet = new MetadataChangeSet.Builder().setMimeType("application/csv").setTitle(getCsvFilename()).build();
                IntentSender intentSender = Drive.DriveApi
                        .newCreateFileActivityBuilder()
                        .setInitialMetadata(metadataChangeSet)
                        .setInitialDriveContents(driveContentsResult.getDriveContents())
                        .build(activity.getGoogleClient());
                try {
                    activity.startIntentSenderForResult(intentSender, DRIVE_REQUEST_CODE_OPENER_EXPORT, null, 0, 0, 0);
                } catch (IntentSender.SendIntentException e) {
                    Log.w(TAG, "Unable to send intent: ", e);
                }
            }
        });
</code></pre>

<p>onActivityResult:</p>

<pre><code>@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    final Uri csvUri = Uri.parse("file://" + getCsvFile(context));
    final File csvFile = new File(csvUri.getPath());
    if(requestCode == DRIVE_REQUEST_CODE_OPENER_IMPORT &amp;&amp; resultCode == activity.RESULT_OK &amp;&amp; data != null) {
        DriveId driveId = (DriveId) data.getParcelableExtra(OpenFileActivityBuilder.EXTRA_RESPONSE_DRIVE_ID);
        Log.i(TAG, "Selected file's ID: " + driveId);
        driveId.asDriveFile().open(activity.getGoogleClient(), DriveFile.MODE_READ_ONLY, null).setResultCallback(new ResultCallback&lt;DriveApi.DriveContentsResult&gt;() {
            @Override
            public void onResult(DriveApi.DriveContentsResult driveContentsResult) {
                try {
                    InputStream input = driveContentsResult.getDriveContents().getInputStream();
                    byte[] dataArray = IOUtils.toByteArray(input);
                    FileUtils.writeByteArrayToFile(csvFile, dataArray);
                    finish.onImportFinished();
                } catch (IOException ie) {
                    Log.e(TAG, "Error downloading file: ", ie);
                }
            }
        });
    } else if(requestCode == DRIVE_REQUEST_CODE_OPENER_EXPORT &amp;&amp; resultCode != activity.RESULT_CANCELED) {
        finish.onExportFinished();
    }
    csvFile.delete();   // Always delete to avoid readable file on disk
}
</code></pre>

<p>Can't select file vault.csv</p>

<p><a href="https://i.stack.imgur.com/M0fgI.png" rel="nofollow"><img src="https://i.stack.imgur.com/M0fgI.png" alt="enter image description here"></a></p>

<p>Update1:</p>

<pre><code>public void initGoogleClient() {
    if (mGoogleApiClient == null) {
        mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addApi(Drive.API)
                .addScope(Drive.SCOPE_FILE)
                .addScope(Drive.SCOPE_APPFOLDER)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .build();
    }
    mGoogleApiClient.connect();
}
</code></pre>

<p>Update2:</p>

<p>If I however first export a file from within my Android app. Then download the file from my browser on my Mac, add some data. Upload it from my Mac.
Now importing this file from my Android app works.</p>

<p>Is there a way to change the privileges on a newly uploaded file via the WEB Google Drive interface? Other comments?</p>

<p>Update3 my Mac Google Drive browser:</p>

<p><a href="https://i.stack.imgur.com/jfR6m.png" rel="nofollow"><img src="https://i.stack.imgur.com/jfR6m.png" alt="enter image description here"></a></p>