0
votes

All I want to do is upload a text file from my android app to my google drive cloud storage.

Google's idea of a simple example is one which takes a camera image directly and saves it on google drive. It involves media types and MIME and whatnot. I want to take a text file for which I know the path on Android and write it (ideally to a folder) on my cloud Google drive storage.

I have spent two days learning Google Drive api. I imported Google's example DriveQuickstart and made it work on my Nexus 7 putting a picture it took on Google Drive.

I simply can't believe that

1) this can't be done easily with an Intent, what BETTER use for reusing apps than to have an Intent that would access the Google Drive Android APP and put a local file on to drive? This is not something I should need to get in to API's for.

2) this can't be done easily with the API, or that a sample app for uploading any file despite its MIME type wouldn't be a more fundamental example than uploading a picture taken with the camera (and never permanently saved locally).

Anyway, I appreciate any simplifying help you can provide. Meanwhile, I continue trying to figure out how to modify DriveQuickstart to do what seems to me the simplest Drive task in the world.

1

1 Answers

0
votes

On 1, are you sure it can't? I can use Files Expert to "share" a text file to Drive. Works for me.

On 2, it really is only a few lines of code to do the upload. What complicates and Drive app is the need to use Oauth for authentication. If you're writing a Drive app. my suggestion is to break the problem into those two distinct aspects. Start by ignoring Drive altogether, and write an app that does Oauth and gives you an access token. Once you have an access token, move on to phase 2, which is the 2 or 3 lines of code that will use that access token to upload your file.