如何从Google Drive中删除LALAOD文件并在Android中显示在图像中
这是我的以下代码。
我从Google Drive有一个问题显示图像。
我也曾使用此图像url url https://drive.google.com/uc?id=file_id ,但仅在具有链接访问的任何人中工作,而不是限制图像。
fun downloadFileFromGDrive(id: String) {
getDriveService()?.let { googleDriveService ->
CoroutineScope(Dispatchers.IO).launch {
val gDriveFile = googleDriveService.Files().get(id).execute()
Log.e("gDriveFile", gDriveFile.toString())
val outputStream: OutputStream = ByteArrayOutputStream()
googleDriveService.files()[id].executeMediaAndDownloadTo(outputStream)
}
} ?: Toast.makeText(context, "Please Log In first!", LENGTH_SHORT).show()
}
This is my following code.
I'm having a issue display image from Google Drive.
Source code from https://www.section.io/engineering-education/backup-services-with-google-drive-api-in-android/
I have also worked with this image url https://drive.google.com/uc?id=FILE_ID but only worked in anyone with the link access not restricted images.
fun downloadFileFromGDrive(id: String) {
getDriveService()?.let { googleDriveService ->
CoroutineScope(Dispatchers.IO).launch {
val gDriveFile = googleDriveService.Files().get(id).execute()
Log.e("gDriveFile", gDriveFile.toString())
val outputStream: OutputStream = ByteArrayOutputStream()
googleDriveService.files()[id].executeMediaAndDownloadTo(outputStream)
}
} ?: Toast.makeText(context, "Please Log In first!", LENGTH_SHORT).show()
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用以下功能,它将下载Google Drive映像,并将其保存到App Private Files文件夹中。
Use the following function It will download Google drive Image and save it to the app private files folder.