DriveFolder.listChildren() not showing all its children

前端 未结 2 1955
名媛妹妹
名媛妹妹 2021-01-19 17:22

I am making an app which works with google drive.

I need to get a list of ALL files inside a folder, but it seems that it isnt possible: when I call listFiles method

2条回答
  •  抹茶落季
    2021-01-19 17:45

    It would take me long time to re-run your example, but I may have a few points to get you ahead.

    First, since there is no DELETE functionality in Google Drive Android API yet, you are probably referring to the "remove" action in the web Drive interface. The status Metadata.isTrashed() does not reflect the status correctly as discussed here. And using requestSync() did not help. But I let this issue go since I expect them to fix it with the implementation of DELETE in GDAA. More on DELETE can be found here.

    Second, I use the "await" version of the calls in my test environment (wrapped in AsyncTask) to test things. It is much easier to step through. I have experienced some "weird" behavior once a while, but could not pinpoint it. Fixed it by clearing the Google Play Services cache.

    Third, there is a Google Api Client wrapper class GooApiClnt in this code (at the bottom) that seems to produce stable results - you may try it. You may test the 'findAll'(i.e. DriveApi.query) versions instead of 'listAll'(i.e. listChildren) since it allows you to filter the TRASHED state upfront. BTW, I noticed that you're not logging the Metadata.isTrashed() status in your example. It would give a better view of what files were deleted. But again, it would only confirm the sync latency issues.

    The last, minor issue - and I don't know if it wasn't fixed on the GDAA level already - the release/closing of the of the 'getMetadataBuffer'. It was causing resource leaks in my code. Again, see the Github code referenced above, grep 'mdb.close()'.

    Happy coding and good luck

提交回复
热议问题