[RESOLVED] Can't record audio on Android devices

I am building an app that needs to record audio. The app works fine on the simulator and on iOS devices but never works on Android devices. I have tried 3 modern droid devices ( all armv7 ) and it has failed on all three.

Even when I try running the sample app below on droid devices it always fails. I click start recording and then stop but I never hear any sound.
http://developer.coronalabs.com/content/simple-audio-recorder

Please let me know if this is a known issue [import]uid: 138352 topic_id: 35545 reply_id: 335545[/import]

@dev45,
Did you set the permission in your build settings? See here…
http://docs.coronalabs.com/api/library/media/newRecording.html

Sincerely,
Brent Sorrentino
[import]uid: 200026 topic_id: 35545 reply_id: 141295[/import]

I copied the source code of the sample project as is and ran the app on the device. When the app is installing it tells me that the device needs permission for Internet, Phone, Record Audio.

And yes, the build settings did have the permissions as you suggested in the sample project I used. To be clear, the sample project I used was the one that comes with Corona SDK.
Corona SDK > SampleCode > Media > SimpleAudioRecorder

Thanks [import]uid: 138352 topic_id: 35545 reply_id: 141340[/import]

Hi again @dev45,
When you say “it tells me that the device needs permission for Internet, Phone, Record Audio”, what is “it”? Is Corona telling you that in the Terminal build output or build report? Or is your system/device telling you that? [import]uid: 200026 topic_id: 35545 reply_id: 141353[/import]

Sorry for not being clear. I know that the permissions are set correctly in build settings. I know this because when I install the app on a device, I get the warning on the device that says the app will have permission to record audio and access the internet. Here is the build settings code

 androidPermissions = {  
 "android.permission.INTERNET",  
 "android.permission.RECORD\_AUDIO"  
 },  

You are being very helpful and I appreciate it. I have tried 3 fairly modern android devices and they failed on all 3. galaxy note, nexus one, and galaxy 2. The app works fine on iOS devices, works fine on simulator, but hasn’t worked on a single Android device. I know it’s not my code because even when I try the sample app from Corona SDK it still fails.

Thanks
Brian
[import]uid: 138352 topic_id: 35545 reply_id: 141544[/import]

Hi Brian,
I investigated your issue further. Android always records audio to 3GP format which our .audio library does not decode. At this time, you can only play 3GP files via the media.playSound() function.

We realize that our “SimpleAudioRecorder” app does not play back the recorded audio (on Android) for the above reason. While we could change it to use our .media APIs, the .audio library is preferable on iOS.

The solution to your project is: do a quick “if android” check when doing recorded audio playback.

Please note that you should call media.playSound() instead of media.playEventSound() because the recorded audio will likely be too large to be loaded as an event sound, and thus it would fail.

Hope this helps,
Brent [import]uid: 200026 topic_id: 35545 reply_id: 141627[/import]

Thanks for your help. This solution works on my Android device. [import]uid: 138352 topic_id: 35545 reply_id: 141772[/import]

Glad to help Brian! Please ask if you need any help in the future.

Brent [import]uid: 200026 topic_id: 35545 reply_id: 141790[/import]

@dev45,
Did you set the permission in your build settings? See here…
http://docs.coronalabs.com/api/library/media/newRecording.html

Sincerely,
Brent Sorrentino
[import]uid: 200026 topic_id: 35545 reply_id: 141295[/import]

I copied the source code of the sample project as is and ran the app on the device. When the app is installing it tells me that the device needs permission for Internet, Phone, Record Audio.

And yes, the build settings did have the permissions as you suggested in the sample project I used. To be clear, the sample project I used was the one that comes with Corona SDK.
Corona SDK > SampleCode > Media > SimpleAudioRecorder

Thanks [import]uid: 138352 topic_id: 35545 reply_id: 141340[/import]

Hi again @dev45,
When you say “it tells me that the device needs permission for Internet, Phone, Record Audio”, what is “it”? Is Corona telling you that in the Terminal build output or build report? Or is your system/device telling you that? [import]uid: 200026 topic_id: 35545 reply_id: 141353[/import]

Sorry for not being clear. I know that the permissions are set correctly in build settings. I know this because when I install the app on a device, I get the warning on the device that says the app will have permission to record audio and access the internet. Here is the build settings code

 androidPermissions = {  
 "android.permission.INTERNET",  
 "android.permission.RECORD\_AUDIO"  
 },  

You are being very helpful and I appreciate it. I have tried 3 fairly modern android devices and they failed on all 3. galaxy note, nexus one, and galaxy 2. The app works fine on iOS devices, works fine on simulator, but hasn’t worked on a single Android device. I know it’s not my code because even when I try the sample app from Corona SDK it still fails.

Thanks
Brian
[import]uid: 138352 topic_id: 35545 reply_id: 141544[/import]

Hi Brian,
I investigated your issue further. Android always records audio to 3GP format which our .audio library does not decode. At this time, you can only play 3GP files via the media.playSound() function.

We realize that our “SimpleAudioRecorder” app does not play back the recorded audio (on Android) for the above reason. While we could change it to use our .media APIs, the .audio library is preferable on iOS.

The solution to your project is: do a quick “if android” check when doing recorded audio playback.

Please note that you should call media.playSound() instead of media.playEventSound() because the recorded audio will likely be too large to be loaded as an event sound, and thus it would fail.

Hope this helps,
Brent [import]uid: 200026 topic_id: 35545 reply_id: 141627[/import]

Thanks for your help. This solution works on my Android device. [import]uid: 138352 topic_id: 35545 reply_id: 141772[/import]

Glad to help Brian! Please ask if you need any help in the future.

Brent [import]uid: 200026 topic_id: 35545 reply_id: 141790[/import]