Skip to content

Not able to create directory with .mp3 file in Android 10 #58

@pgandroid1289

Description

@pgandroid1289

I m using this call recorder for Android 10. As i saw the issue that it is not working in Android 10. So i have modify the code as per coments.

class MyAccessibilityService : AccessibilityService() {
var mService: Service? = null
override fun onAccessibilityEvent(event: AccessibilityEvent) {}
override fun onInterrupt() {}
override fun onServiceConnected() {}
override fun onCreate() {
    mService = this
}
}

 <service
        android:name="com.services.MyAccessibilityService"
        android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
        <intent-filter android:priority="1000">
            <action android:name="android.accessibilityservice.AccessibilityService" />
        </intent-filter>

        <meta-data
            android:name="android.accessibilityservice"
            android:resource="@xml/accessibility_service_config" />
    </service>

And then i call this code for recording

   private fun startRecording() {
 
   var source = MediaRecorder.AudioSource.VOICE_COMMUNICATION
    if (VERSION.SDK_INT >= 29) source = MediaRecorder.AudioSource.VOICE_RECOGNITION
    callRecord = CallRecord.Builder(this)
        .setRecordFileName("Record")
        .setRecordDirName("Mobile")
        .setRecordDirPath(getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS)!!.absolutePath)
        .setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB)
        .setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
        .setAudioSource(source)
        .setLogEnable(true)
        .setShowSeed(true)
        .setShowPhoneNumber(true)
        .build()
    callRecord.startCallReceiver()


    println(" ${callRecord!!.recordDirName}")
    println(" ${callRecord!!.recordFileName}")
    println(" ${callRecord!!.recordDirPath}")

   }

and for stop it,

  private fun stopRecording() {
    callRecord.stopCallReceiver()
  }

But i m not able to see directory in my file manager. So i am not sure that if recording file is storing or not because i m not able to see directory or folder anywhere in my file manager.

So please help me out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions