6

I am getting error like start recording() called uninitialized audio recording in android 2.3.4 version mobile(LG),its working fine in android 2.2 but throwing error in android 2.3.

sravanthi
  • 183
  • 1
  • 3
  • 9

2 Answers2

17

Also, make sure that you have this permission set in your AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

Michael Litvin
  • 3,976
  • 1
  • 34
  • 40
  • 3
    This needs to be outside the ```application``` but within the ```manifest``` block to work. – Adamski Nov 12 '14 at 21:31
  • You'd hope Google could mention this in the error! Instead we find ourselves testing the state, finding it is 'initialized', calling startRecording on the object and getting an error that says it's not initialized. – Andrew G Jan 25 '15 at 14:16
0

I am answering this question too late. May be my answer help other developers in future. Since Android 6.0 Marshmallow, application will not be granted any permission at installation time. Application has to ask user for a permission at run time. Permission request dialog will not launch automatically developer has to call for it manually after checking if permissions are given or not. In above case developer has to ask for android.permission.RECORD_AUDIO permission at run time. And also for android.permission.WRITE_EXTERNAL_STORAGE if saving recording to external storage. Also add to manifest as

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<!--Audio Record Permission-->
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Hope it will help some dev out.

Rahul Sharma
  • 12,515
  • 6
  • 21
  • 30