简体   繁体   中英

Android upload/download text files from sdcard to Google Drive with Google Play Services

I want to implement Google Drive upload/download txt file to my Android app using Google Play Services, but I don't find a right way to do it.

In dropbox is very easy:

File file = new File("working-draft.txt");
FileInputStream inputStream = new FileInputStream(file);
Entry response = mDBApi.putFile("/magnum-opus.txt", inputStream,
                            file.length(), null, null);
Log.i("DbExampleLog", "The uploaded file's rev is: " + response.rev);

But for Google Drive with Google Play Services I have not found a simple way like that. Do you know how to?

By the way, I would like to use my own credentials (google service account) instead an user account, what is the way to implement it with Google Play Services?

Thanks in advance

Take a look here , it does everything you've mentioned. I don't know about the 'simple' requirement, though. Or go through the official DEMO code here . But it is definitely not a 'two-liner' endeavor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM