Reputation: 373
Brief: How to check if voice recording is already running in background in some other app.
Detail: if voice recording is already running in background from native app: Voice recorder. Now I have implemented voice recording as one of feature in my application.
Problem: when i try recording in my app at the same time, it gives error :
: E/MediaRecorder: start failed: -38
: E/MyApp: [1162][com.sec.MyApp.multimedia.RecordMyVoice]java.lang.IllegalStateException
: E/MyApp: at android.media.MediaRecorder.start(Native Method)
: E/MyApp: at com.sec.MyApp.multimedia.RecordMyVoice.doInBackground(RecordMyVoice.java:100)
Code at 100th line in RecordMyVoice.java:
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setOutputFile(mFileName);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.prepare();
mRecorder.start(); //code at 100th line
But problem is because already voice recording is running in background. Therefore is there any way to stop voice recording if its running in some other app.
Any input would be of great help.
Upvotes: 4
Views: 6717
Reputation: 6751
i've had the same Error -38, i found out that there is Another background service that uses the mic via (AudioRecord), when disabling the background service , it worked.
Upvotes: 1