I have uploaded an apk file in google drive using the desktop.
Now I need to download that apk file to in to my android SDCARD when I click on a button in my android activity. How to achieve this.
I have uploaded an apk file in google drive using the desktop.
Now I need to download that apk file to in to my android SDCARD when I click on a button in my android activity. How to achieve this.
This is simple to accomplish using the new Android API. If the app that uploaded it on the web has the same app id as the one on Android, your app will already have access to the file. In that case you can use the query functionality to locate the file.
Otherwise, you can use the OpenFileActivity and ask the user to select the apk they want to download.
Once you have the DriveId of the file, you can open the contents following the read contents guide.
First, you have to use the RESTful API, since you have to open Drive in a DRIVE_FILE scope. The GDAA has only FILE scope and will not see anything your Android app did not create.
In the RESTful API, it is a 3 step process
In both step 1 and 2, use the 'try it' playground at the bottom of the pages to form your query and field selection correctly. Step 3 is well documented elsewhere. Here's some out-of-context code that may help
Steps 1 and 2 in the code above have to be in the non-UI thread (like AsyncTask) and there is a lot of error handling that has to be implemented (UserRecoverableAuthIOException...) around it.