I'm currently trying to create a new Google Spreadsheet file using the Google Drive Android API. At the moment, this is the content of my ResultCallback class:
@Override
public void onResult(ContentsResult result) {
if (!result.getStatus().isSuccess()) {
// Handle error
return;
}
MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
.setTitle("My Spreadsheet")
.setMimeType("application/vnd.google-apps.spreadsheet").build();
Drive.DriveApi.getRootFolder(mGoogleApiClient)
.createFile(mGoogleApiClient, changeSet, result.getContents())
.setResultCallback(fileCallback);
}
Every time I run the app I get the warning log "Upload failed HTTP status 400". However, if I change the MIME type to any non-Google service (eg. text/plain, application/vnd.ms-excel, etc.), the file is created successfully. Is this happening because I cannot create empty Google Docs files using the API?
Thank you.