Android Question Audio recording problem with the samples

JukkaHo

Member
Licensed User
Audio recording steamer or to a wave file
I get this error with both versions:

java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
at android.media.AudioRecord.startRecording(AudioRecord.java:1013)
at anywheresoftware.b4a.audio.AudioStreamer.StartRecording(AudioStreamer.java:98)

The manifest is:

AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

Test device is Huawei P Smart

thanks
JukkaHo
 

JohnC

Expert
Licensed User
Longtime User
Upvote 0

JukkaHo

Member
Licensed User
Thanks PassionDEV,

As you correctly guessed, the actual problem was with permissions.

This helped:

If FirstTime Then
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result<>True Then
ExitApplication
End If
rp.CheckAndRequest(rp.PERMISSION_RECORD_AUDIO)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result<>True Then
ExitApplication
End If


So these work fine.
 
Upvote 0

JukkaHo

Member
Licensed User
Thank you, Erel

That is neat coding.

I have been using Basic languages long time, some say too long time since QuickBASIC and later other even
Visual Basic For DOS and latest .NET versions and around 2000 some Basic for Palm devices
but B4A has been the most beautiful one.
It has it's specific approach to coding but very easy to adopt. It is also powerful and easy to extend with Javaobjects and Java parts.
And you can use your code in other environments easily.
Logging and B4A Bridge are very useful and nice testing tools.
The pearl is support which is top of tops with this community!

thank you
JukkaHo
 
Upvote 0
Top