HelloWorld
HelloWorld

Reputation: 2355

How to check if RECORD_AUDIO permission has been granted in Codename One (Android 6.0+)

My app features among othes an audio recorder (this roots to this previous SO question). I use the following code to start audio recording :

audioMemoRecorder = MediaManager.createMediaRecorder(audioMemoPath, audioMemoMimeType);

   if (audioMemoRecorder != null){ // this does not prevent app from crashing
       audioMemoRecorder.play();
   }

On an Android 6.0 device when I click on the record button the app crashes, because the record_audio permission is not granted by default. So I guess MediaManager.createMediaRecorder() does not return correctly.

However the problem is that the app does not prompt for this permission, and crashes straightforwardly.

Please note that if the user gives this record_audio permission the app works properly.

How can I check before enabling the buttons if the record_audio permission has been granted ?

Any hint appreciated,

BR

Upvotes: 1

Views: 146

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

That's an omission in the current port (we added it to the capture but missed the media recorder) this will be fixed in the next update.

Upvotes: 1

Related Questions