[英]Files created by the NEW Google Drive Android API (GDAA) not showing up
First, everything looked OK until yesterday (Mar 12, 2014). 首先,直到昨天(2014年3月12日),一切看起来都还不错。 Since about lunch time, files (not folders) created by GDAA are not showing in the Web Drive interface anymore.
由于大约是午餐时间,因此GDAA创建的文件(不是文件夹)不再显示在Web Drive界面中。 A few showed up with a considerable delay (3+ hours) and nothing since.
一些人出现了相当多的延迟(3个多小时),此后没有任何反应。 The Android GDAA find/search facility shows both the files (including contents) and folders, but the Web Drive has only folders.
Android GDAA查找/搜索工具同时显示文件(包括内容)和文件夹,但Web驱动器仅包含文件夹。 I use this code to test it , but I've tried the official demo as well with the same result.
我使用此代码对其进行测试 ,但我也尝试了官方演示 ,结果相同。
Fixed by emptying the Google Play Services cache using standard Android device 通过使用标准Android设备清空Google Play服务缓存来解决
Settings -> Apps -> Google Play Services -> Clear Cache
probably a snag caused by a development environment abuse of the services. 可能是由于开发环境滥用服务而导致的故障。 Will investigate further if it reappears.
如果再次出现,将进行进一步调查。
... continued ... 继续
As I was digging deeper, I have discovered a quirk that looks like a non-issue, but can create a big problem for app developers. 当我深入研究时,我发现了一个看起来很像问题的怪癖,但却可能给应用程序开发人员带来一个大问题。
1/ lets assume that user can go to device's 1 /假设用户可以转到设备的
Settings -> Apps -> Google Play Services -> Manage Space -> Clear All Data
anytime she/he decides to. 任何时候她/他决定。 The app that uses GDAA has no knowledge of this action, and the device owner has no idea that Google Play Services has anything to do with Google Drive based app.
使用GDAA的应用程序不知道此操作,设备所有者也不知道Google Play服务与基于Google云端硬盘的应用程序有关。
2/ The moment this happens the GDAA app loses it's ability to find folders / files by TITLE. 2 /一旦发生这种情况,GDAA应用程序便失去了按TITLE查找文件夹/文件的功能。 Queries fail here (see "NO md AVAILABLE")
查询在这里失败(请参阅“无可用md”)
...
if (rslt.getStatus().isSuccess()) {
MetadataBuffer mdb = null;
try {
mdb = rslt.getMetadataBuffer();
if (mdb == null) return null;
dMDs = new ArrayList<DrvMD>();
for (Metadata md : mdb) {
if ((md == null) || (!md.isDataValid()) || (md.isTrashed())) continue;
// NO md AVAILABLE !!!
}
} finally { if (mdb != null) mdb.close(); }
}
Even though it looks like a minor quirk, the fact that user can do this freely, causes MAJOR problem to the apps. 即使看起来像是一个小怪癖,但用户可以自由地执行此操作的事实也会导致应用程序出现重大问题。
Here's why: Creating a folder/file in Google Drive will NOT fail if one with the same name exists. 原因如下:如果存在同名文件夹,则在Google云端硬盘中创建文件夹/文件不会失败。 It will create a new one with the same name (and I understand the model).
它将创建一个具有相同名称的新模型(我理解该模型)。 But if there is no reliable way to query for existence by name (caused by the user's action above), the app fails in this logic:
但是,如果没有可靠的方法来按名称查询是否存在(由上述用户操作引起),则该应用程序将在以下逻辑中失败:
if (FOLDER/FILE by name exists)
return FOLDER/FILE ID
else
ID = create a new FOLDER/FILE
And so far this is the only logic I can come up when creating/accessing folder/file. 到目前为止,这是创建/访问文件夹/文件时唯一能想到的逻辑。 I know there are 2 more unique IDs available (resource ID and DriveId), but they are not useful in this situation.
我知道还有2个唯一的ID(资源ID和DriveId)可用,但是在这种情况下它们没有用。 Any ideas how to get around this?
任何想法如何解决这个问题? It would be nice if Google Play Services recovered from user's action without losing it's ability to query existing objects.
如果Google Play服务能够从用户的操作中恢复过来而又不会失去查询现有对象的能力,那将是很好的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.