How to check whether another Recorder is running or not?
Asked Answered
Q

1

5

I use AudioRecord API to record audio (WAV) in my app, and it records successfully. But my app behaves strange when i try to record while other recording apps are running in the background.

The MediaRecorder API throws exception when attempting to start recording while another recorder is running but the AudioRecord API initializes the recorder instance and doesn't throw any exceptions, so i cant identify whether any recorder instance is running or not.

This scenario has been handled in Samsung S3's default Voice Recorder, when i try to record it says

" Unable to start new recording. Other applications already recording"

How can i identify whether any other recorder is running or not before my app's recorder starts?

Quarta answered 4/7, 2013 at 13:38 Comment(2)
did you get any idea , how can we do that ?Scarlatina
@SakiMake yes, i'l post it as answer.Quarta
Q
7

I have found solution to this problem

Since the AudioRecord doesn't throw any exceptions unlike MediaRecorder API, i have gone for another workaround.

When another recorder instance is running i have found that the read method returns 0 instead of ERROR_INVALID_OPERATION or ERROR_BAD_VALUE. So if the first read operation returns 0 , i showed an error message as "Recorder cannot be initialized".

Quarta answered 17/7, 2013 at 3:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.