Servicios de Google Play Llamada de DriveApi para cargar un archivo local

With Google APIs Java Client you can synchronously upload a file to Drive with

    mDriveService.files().insert(body, mediaContent).execute();

Is there an equivalent function with the new Android's Google Play Services DriveApi? It seems that you can only upload new files with something like this:

    Contents newContents = Drive.DriveApi.newContents(mGoogleApiClient).await().getContents();
    OutputStream outStream = newContents.getOutputStream();

    InputStream inputStream = new FileInputStream(myLocalFile);
    byte[] data = new byte[16000];
    while ((nRead =, 0, data.length)) != -1) {

    MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
    DriveFileResult createResult = destFolder.createFile(mGoogleApiClient, changeSet, newContents).await();

My problem with the above code is that if the local file I want to upload is very big (think about a recorded video, for example) it force you to duplicate the file on device's storage and this create big problems in some cases.

preguntado el 28 de mayo de 14 a las 12:05

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.