Currently I am able to save files to my Google Drive account programmatically through the usual sample code that Google provides (I followed the steps of this former question):
// Create the initial metadata - MIME type and title.
// Note that the user will be able to change the title later.
MetadataChangeSet metadataChangeSet =
new MetadataChangeSet.Builder()
.setMimeType("image/jpeg")
.setTitle(timestamp+"_"+tagIDval+".jpg")
.build();
// Set up options to configure and display the create file activity.
CreateFileActivityOptions createFileActivityOptions =
new CreateFileActivityOptions.Builder()
.setInitialMetadata(metadataChangeSet)
.setInitialDriveContents(driveContents)
.build();
return mDriveClient
.newCreateFileActivityIntentSender(createFileActivityOptions)
.continueWith(
new Continuation<IntentSender, Void>() {
@Override
public Void then(@NonNull Task<IntentSender> task) throws Exception {
startIntentSenderForResult((IntentSender) task.getResult(), REQUEST_CODE_CREATOR, null, 0, 0, 0);
return null;
}
});
When the code calls the above interface, the file is saved into the Google drive account, but the usual Google drive prompt screen "Upload to Drive" appears in my device and my default "Title" (file name), current drive Account name and the current selected/available Folder are shown. Then it is possible to press "Cancel" or "Save" to finish the action, or create a sub-folder on the fly, etc. It looks more or less like this:
I would like to avoid that screen because my code already sets the file name and the folder is the root folder, and indeed the user does not need to modify that setting, so: is there a parameter for "metadataChangeSet" or "createFileActivityOptions" such that I can jump the "Upload to Drive" screen and directly save using the name and folder that was already set in the code? I have been checking the API but I cannot see clearly how to do that (if possible at all). Thanks in advance!
Update 2018/02/06: if it is not possible to avoid it, is it possible at least to send a key stroke to automatically click the save button area? also a trick like that would be very appreciated. The goal is automatically go through that screen if it is not possible to avoid it completely.