问题描述
我正在使用新的 Google play service drive api 在我的 android 应用程序中使用 App 文件夹实现数据的备份和恢复.我按照 google drive 开发人员指南中的说明进行操作.我只使用时可以成功备份和恢复数据一台设备,不要卸载并重新安装应用程序.但是当我使用两台设备或卸载并重新安装应用程序时会出现问题.
I'm using the new Google play service drive api to implement backup and restore data with App folder in my android application.I followed the intructions from the google drive developer guides.I can backup and restore data successfully when I only use one device and don't uninstall and reinstall the app.But Problem appears when I use two devices or unintall and reinstall the app.
场景1:我在一台设备上安装我的应用程序并成功备份数据到应用程序文件夹",我可以在谷歌驱动器管理应用程序"中看到我的应用程序文件夹的数据大小发生了变化,然后我在另一台设备上安装了我的应用程序并尝试使用从谷歌驱动器恢复"来恢复我刚刚在第一台设备上备份的数据.但是谷歌驱动器 api 返回了空的 MetadataBuffer.
Scene 1: I install my app on one device and backup data to "App folder" succeed and I can see the data size of my app folder changed in Google drive "Manage apps",then I install my app on another device and try to use "restore from google drive" to restore the data I just backup on the first device.but google drive api returned empty MetadataBuffer.
场景 2:我在一台设备上安装我的应用程序并成功将数据备份到应用程序文件夹",我还看到管理应用程序"中我的应用程序文件夹的数据大小发生了变化.然后我卸载我的应用程序并重新安装它并尝试恢复我备份的数据.同样的事情发生了.在我的应用文件夹中找不到文件.
Scene 2: I install my app on one device and backup data to "App folder" succeed and I also see the data size of my app folder changed in "Manage apps".then I uninstall my app and reinstall it and try to restore the data I backup.the same thing happened.There's no file find in my app folder.
我尝试了同时使用 queryChildren 和 listChildren 的 api,但没有成功.
I tried api with both queryChildren and listChildren but no lucky.
Drive.DriveApi.getAppFolder(getGoogleApiClient())
.queryChildren(getGoogleApiClient(), query)
和
Drive.DriveApi.getAppFolder(mGoogleApiClient).listChildren(mGoogleApiClient)
谷歌驱动团队的任何人都可以解决这个问题吗?我认为这是一个非常大的错误.我们仍然没有解决方法.
Can anyone from google drive team resolve the problem? I think it's a really big bug.we still have no resolve method.
推荐答案
我们发现了一个 API 问题,这意味着在卸载应用程序然后重新安装后,没有下载应用程序文件夹内容.这将在下一版本的 Google Play 服务中得到修复.
We have identified an issue with the API that meant App Folder content was not downloaded after an app was uninstalled then reinstalled. This will be fixed in the next release of Google Play services.
出于开发目的,您可以通过清除 Google Play 服务数据(设置 > 应用程序 > Google Play 服务 > 管理空间 > 清除所有数据)在当前的 Google Play 服务(6.1 版)中解决此问题.我们不建议向最终用户推荐此解决方案,因为这可能会清除其他应用所依赖的数据.
For development purposes, you can work around this issue in the current Google Play services (version 6.1) by clearing Google Play services data (Settings > Apps > Google Play services > Manage Space > Clear all data). We don't recommend suggesting this solution to end users as this will likely clear data relied on by other apps.
问候,
丹尼尔
这篇关于当我使用 queryChildren 时,Android Google drive App 数据文件夹返回空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!