According to the docs the RELATIVE_PATH Added in API level 29 public static final String RELATIVE_PATH Relative path of this media item within the storage device where it is persisted. For example, an item stored at /storage/0000-0000/DCIM/Vacation/IMG1024.JPG would have a path of DCIM/Vacation/.
How can I organize my media files that being inserted to MediaStore on Android prior to Android Q
Afaik: PRIMARY_DIRECTORY
doesn't work
put(MediaStore.MediaColumns.PRIMARY_DIRECTORY, relativePath)
according to the docs it has been removed
/**
* 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";
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
, create a directory under there, and save your images using ordinary file I/O. – Delegacy