新的 Google Drive Android API (GDAA) 创建的文件未显示 [英] Files created by the NEW Google Drive Android API (GDAA) not showing up

查看:32
本文介绍了新的 Google Drive Android API (GDAA) 创建的文件未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,直到昨天(2014 年 3 月 12 日)之前,一切看起来都还不错.从午餐时间开始,由 GDAA 创建的文件(不是文件夹)不再显示在 Web Drive 界面中.一些人出现了相当大的延迟(3 小时以上),此后就没有了.Android GDAA 查找/搜索工具同时显示文件(包括内容)和文件夹,但 Web Drive 只有文件夹.我使用 这段代码来测试它,但我我也尝试了 官方演示,结果相同.

First, everything looked OK until yesterday (Mar 12, 2014). Since about lunch time, files (not folders) created by GDAA are not showing in the Web Drive interface anymore. A few showed up with a considerable delay (3+ hours) and nothing since. The Android GDAA find/search facility shows both the files (including contents) and folders, but the Web Drive has only folders. I use this code to test it, but I've tried the official demo as well with the same result.

推荐答案

已通过使用标准 Android 设备清空 Google Play 服务缓存修复

Fixed by emptying the Google Play Services cache using standard Android device

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.

...继续

随着我的深入研究,我发现了一个看似无关紧要的怪癖,但却会给应用开发者带来大问题.

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/假设用户可以访问设备的

1/ lets assume that user can go to device's

Settings -> Apps -> Google Play Services -> Manage Space -> Clear All Data

任何时候她/他决定.使用 GDAA 的应用不知道此操作,设备所有者也不知道 Google Play 服务与基于 Google Drive 的应用有任何关系.

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.

2/发生这种情况时,GDAA 应用程序将失去按 TITLE 查找文件夹/文件的能力.此处查询失败(参见NO md AVAILABLE")

2/ The moment this happens the GDAA app loses it's ability to find folders / files by TITLE. Queries fail here (see "NO md AVAILABLE")

...
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.

原因如下:如果存在同名文件夹/文件,则在 Google 云端硬盘中创建文件夹/文件不会失败.它将创建一个具有相同名称的新名称(我了解模型).但是如果没有可靠的方法来通过名称查询存在(由上述用户的操作引起),应用程序将在此逻辑中失败:

Here's why: Creating a folder/file in Google Drive will NOT fail if one with the same name exists. 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

到目前为止,这是我在创建/访问文件夹/文件时能想到的唯一逻辑.我知道还有 2 个可用的唯一 ID(资源 ID 和 DriveId),但在这种情况下它们没有用.任何想法如何解决这个问题?如果 Google Play 服务从用户的操作中恢复而不会失去查询现有对象的能力,那就太好了.

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. 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 Drive Android API (GDAA) 创建的文件未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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