Hello ,
on android version up to latest one android 33 , when recording or capturing audio from wireless Bluetooth microphone , i am using b4a , so my app does not capture the audio form the
paired and connected Bluetooth device unless or until i execute the below code :
and also when i need to stop the recording from the wireless BT mic , i just have to execute the below code
meaning that startbluetoothsco will let android switch recording from built in mic to the paired and connected microphone , then stopbluetoothsco will switch the mic to the built_in Mic back again .
Now My Question , Android 14 SDK 34 , the above startblutoothsco & stopbluetoothsco will be deprecated can not be used any more , so we can not use them any more ,, alternatively or the alternative way that i have found that SETCOMMUNICATIONDEVICE(device) has been available in android since i think android 11 as alternative way of doing it so when we need to switch audio recording to the BT MIC
we just have to use setcommunicationdevice(device) then when we need to clear it out or switch the audio recording back to the built in MIC we just need to execute Clearcommunicationdevice(device) could any body have a B4A code to do that just like the above code for startblutoothsco / stopbluetoothsco, it does not have to b the same as the above code , it could be deferent but to do the needed functionality , i needed an alternative way for Android 14 sdk 34 to this so it will keep working on android 14 and above ,
again could any body help to provide B4A code to start and stop audio Recording from BT Mic using setcommunicationdevice(device) / clearcommunicationdevice(device)
and by the way i am using Audiorecord and also audiotrack to record audio then to play it back .
i will really appreciate if any body can provide that code , and thanks in advance .
on android version up to latest one android 33 , when recording or capturing audio from wireless Bluetooth microphone , i am using b4a , so my app does not capture the audio form the
paired and connected Bluetooth device unless or until i execute the below code :
B4X:
Sub StartBluetoothSco()
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "audio", "java.lang.String")
r.RunMethod("startBluetoothSco")
Log("startBluetoothSco")
End Sub
and also when i need to stop the recording from the wireless BT mic , i just have to execute the below code
B4X:
Sub stopBluetoothSco()
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "audio", "java.lang.String")
r.RunMethod("stopBluetoothSco")
Log("stopBluetoothSco")
End Sub
meaning that startbluetoothsco will let android switch recording from built in mic to the paired and connected microphone , then stopbluetoothsco will switch the mic to the built_in Mic back again .
Now My Question , Android 14 SDK 34 , the above startblutoothsco & stopbluetoothsco will be deprecated can not be used any more , so we can not use them any more ,, alternatively or the alternative way that i have found that SETCOMMUNICATIONDEVICE(device) has been available in android since i think android 11 as alternative way of doing it so when we need to switch audio recording to the BT MIC
we just have to use setcommunicationdevice(device) then when we need to clear it out or switch the audio recording back to the built in MIC we just need to execute Clearcommunicationdevice(device) could any body have a B4A code to do that just like the above code for startblutoothsco / stopbluetoothsco, it does not have to b the same as the above code , it could be deferent but to do the needed functionality , i needed an alternative way for Android 14 sdk 34 to this so it will keep working on android 14 and above ,
again could any body help to provide B4A code to start and stop audio Recording from BT Mic using setcommunicationdevice(device) / clearcommunicationdevice(device)
and by the way i am using Audiorecord and also audiotrack to record audio then to play it back .
i will really appreciate if any body can provide that code , and thanks in advance .