I have a serial bluetooth device that I can pair with my Android 11 phone. I am using the code from the example "chat" app to make my bluetooth connection. I can connect and run my app with anything but Android 11. Once I hit connect it jumps straight to "disconnected". This is what I get in the log.
This is the serial device I am using: http://www.usconverters.com/bluetooth-serial-adapter?zenid=f80b592983966cac53a604d43eb66f4c.
The phone is manually paired with the device before the app is ran.
This is my manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
This is my sub from the example:
I send data to that and then to an xbee radio.
(IOException) java.io.IOException: read failed, socket might closed or timeout, read ret: -1
I have added AddPermission(android.permission.ACCESS_FINE_LOCATION) to my manifest. I have also tried both android:targetSdkVersion="29" and also tried the "30" that seems to be required in google play (please correct me if I am wrong there... I am new to this).
Anything else I need to add for this to work in Android 11?
This is the serial device I am using: http://www.usconverters.com/bluetooth-serial-adapter?zenid=f80b592983966cac53a604d43eb66f4c.
The phone is manually paired with the device before the app is ran.
This is my manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
Manifest block:
AddManifestText(
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
AddPermission(android.permission.BLUETOOTH_ADMIN)
AddPermission(android.permission.BLUETOOTH)
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(permission.ACCESS_BACKGROUND_LOCATION)
This is my sub from the example:
My sub:
Public Sub ListenForConnections
'this intent makes the device discoverable for 300 seconds.
Dim i As Intent
i.Initialize("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE", "")
i.PutExtra("android.bluetooth.adapter.extra.DISCOVERABLE_DURATION", 300)
StartActivity(i)
serial.Listen
End Sub
I send data to that and then to an xbee radio.
(IOException) java.io.IOException: read failed, socket might closed or timeout, read ret: -1
I have added AddPermission(android.permission.ACCESS_FINE_LOCATION) to my manifest. I have also tried both android:targetSdkVersion="29" and also tried the "30" that seems to be required in google play (please correct me if I am wrong there... I am new to this).
Anything else I need to add for this to work in Android 11?
Last edited: