Android Q 范围存储和外部库

Android Q Scoped Storage and external libraries

如果外部库只接受 java.io.File 或者 Android 10 上的文件路径会怎样? 是否所有不使用 DocumentFile 或使用媒体存储处理 Uri 的外部库都无法使用?

例如: 我喜欢在 Android 10 及更高版本上使用这个库: https://github.com/ericfarng/jid3lib

但是这个库只处理 java.io.File 或文件路径。我将来必须使用哪些选项?

我认为有很多应用程序在 Google 发生变化后变得无法使用。是这样还是每个场景都有一个选项来维持当前的功能?

What happens if a external library only accept a java.io.File ore a filepath on Android 10? Are all external libraries which didn't use DocumentFile or handle a Uri with the media store, unusable?

您始终可以将内容复制到您控制的文件中(例如,在 getCacheDir() 中),然后使用包含该副本的库。

此外,在 Android R 上(至少通过 DP3),“原始路径”基本上意味着 READ_EXTERNAL_STORAGE works again for accessing external storage。因此,您可能只需要担心 Android 10.

的复制问题

For example: I like to use this library on Android 10 and above: https://github.com/ericfarng/jid3lib

But this library only handles java.io.File or filepath. Which options did i have to use it in the future?

由于该库是开源的,您可以选择制作自己的可以在 InputStream 上运行的库副本。该特定库将有些难以修改,因为它依赖于 RandomAccessFile.