store the recordings in an own folder, within the Music folder

This commit is contained in:
tibbi 2021-03-05 19:52:26 +01:00
parent caef0051dd
commit da60a8a1a0
1 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import android.content.Intent
import android.media.MediaRecorder
import android.media.MediaScannerConnection
import android.os.Build
import android.os.Environment
import android.os.IBinder
import android.provider.MediaStore
import android.provider.MediaStore.Audio.Media
@ -164,12 +165,13 @@ class RecorderService : Service() {
@SuppressLint("InlinedApi")
private fun addFileInNewMediaStore() {
val audioCollection = Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
val storeFilename = currFilePath.getFilenameFromPath()
val newSongDetails = ContentValues().apply {
put(Media.DISPLAY_NAME, storeFilename)
put(Media.TITLE, storeFilename)
put(Media.MIME_TYPE, storeFilename.getMimeType())
put(Media.RELATIVE_PATH, "${Environment.DIRECTORY_MUSIC}/Recordings")
}
val newUri = contentResolver.insert(audioCollection, newSongDetails)