addMedia

suspend fun addMedia(fileName: String, bytes: ByteArray): String(source)

Adds a photo or video to the device's gallery and returns its device path: bytes are written as fileName (letters, digits, ., _, - or spaces, with a photo extension — jpg, jpeg, png, gif, webp, heic, heif, bmp — or a video one — mp4, 3gp, webm, mkv, mov) to /sdcard/Pictures/Tap/ or /sdcard/Movies/Tap/, and indexed by the media scanner so gallery apps and photo pickers list it (read back). A name already there is refused (FailureReason.DEVICE_FILE) unless this device handle added it. Deleted, and dropped from the index, on detach; nothing else in the gallery is touched.


suspend fun addMedia(source: Path, fileName: String = source.fileName.toString()): String(source)

addMedia with the bytes of the local file source, named fileName (its own name by default).