w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Google Drive Android API how to upload a audio file to my drive ? How to sync drive files?

I haven't played with audio files, but in general, the Google Drive Android API (GDAA) does not deal with audio files per say. You just create a file, set metadata and stuff binary content in it. Look at the code here (plus some readme blah blah here). You'll find a code line

 byte[] buff = ("written on: " + _dfn.getName()).getBytes();
 if (null == _gc.creatFile(fldr, name, MIMETEXT, buff))  return;

there, that produces byte[] buffer and creates a file with text MIME type. So, try to use it, just replace the MIME type and stuff the 'buff' with your audio stream. I do it successfully with JPEG binaries.

There is also GooApiClnt wrapper class there that handles most of the basic GDAA functions. Don't try to code this way at work, though, it may get you fired :-).

Good luck.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.