Android的 - 如何下载从谷歌文件的驱动器到Android SD卡? [英] Android - How to download the file from google drive to android SDCARD?

查看:118
本文介绍了Android的 - 如何下载从谷歌文件的驱动器到Android SD卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经上传使用桌面在谷歌驱动器的APK文件。

I have uploaded an apk file in google drive using the desktop.

现在我需要在apk文件下载到我的android的SD卡,当我在我的Andr​​oid活动点击一个按钮。如何实现这一点。

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.

推荐答案

这是简单的实现采用全新Android API。如果上传它在网络上的应用程序具有相同的应用程序ID作为一个在Android上,您的应用程序就已经可以访问文件。在这种情况下,你可以使用<一个href="https://developer.android.com/reference/com/google/android/gms/drive/DriveApi.html#query%28com.google.android.gms.common.api.GoogleApiClient,%20com.google.android.gms.drive.query.Query%29"相对=nofollow>查询功能找到该文件。

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.

否则,您可以使用<一个href="https://developer.android.com/reference/com/google/android/gms/drive/OpenFileActivityBuilder.html"相对=nofollow> OpenFileActivity 并要求用户选择他们要下载的APK。

Otherwise, you can use the OpenFileActivity and ask the user to select the apk they want to download.

在你的文件的DriveId,您可以打开以下内容的阅读内容指南。

Once you have the DriveId of the file, you can open the contents following the read contents guide.

这篇关于Android的 - 如何下载从谷歌文件的驱动器到Android SD卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆