Hello I get this error when trying to run the Audiostream example on my device:
Installing file to device. Error
adb: failed to install 1_RAPID_DEBUG.apk: Failure [-26: Package b4a.example new target SDK 14 doesn't support runtime permissions but the old target SDK 26 does.]
Add this line in Globals: Private RP As RuntimePermissions
This line in Activity_Create: RP.CheckAndRequest(RP.PERMISSION_RECORD_AUDIO)
And this routine:
B4X:
Private Sub Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = RP.PERMISSION_RECORD_AUDIO Then
AudioStreamer1.Initialize("AudioStreamer1", Starter.SampleRate, ChannelMono, AudioFormat, AudioStreamer1.VOLUME_MUSIC)
End If
End Sub
Add this line in Globals: Private RP As RuntimePermissions
This line in Activity_Create: RP.CheckAndRequest(RP.PERMISSION_RECORD_AUDIO)
And this routine:
B4X:
Private Sub Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = RP.PERMISSION_RECORD_AUDIO Then
AudioStreamer1.Initialize("AudioStreamer1", Starter.SampleRate, ChannelMono, AudioFormat, AudioStreamer1.VOLUME_MUSIC)
End If
End Sub
I have coded it like this and it works... I found that I had to enable the RunTimePermissions library in the Library Manager..
B4X:
RP.CheckAndRequest(RP.PERMISSION_RECORD_AUDIO)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = True Then
Activity.LoadLayout("1")
If FirstTime Then
streamer.Initialize("streamer", 44100, True, 16, streamer.VOLUME_MUSIC)
buffers.Initialize
timer1.Initialize("timer1", 1000)
End If
End If