根据文档,在 API 级别 29 中添加的 RELATIVE_PATH public static final String RELATIVE_PATH 此媒体项目在存储设备中的相对路径,它被持久化。例如,存储在 /storage/0000-0000/DCIM/Vacation/IMG1024.JPG 的项目将具有 DCIM/Vacation/ 路径。
如何在 Android Q Afaik 之前组织我在 Android 上插入到 MediaStore 的媒体文件:根据已删除的文档PRIMARY_DIRECTORY
不起作用
put(MediaStore.MediaColumns.PRIMARY_DIRECTORY, relativePath)
/**
* The primary directory name this media exists under. The value may be
* {@code NULL} if the media doesn't have a primary directory name.
*
* @removed
* @deprecated Replaced by {@link #RELATIVE_PATH}.
*/
@Column(Cursor.FIELD_TYPE_STRING)
@Deprecated
public static final String PRIMARY_DIRECTORY = "primary_directory";