How to detect if bluetooth is possibe to use in device

AllyAndroid

Member
Licensed User
Longtime User

The tutorial is posted here: http://www.b4x.com/forum/basic4andr...s/6908-android-serial-tutorial.html#post39900

The code you referenced still works but you would need to initialize Serial1 first.

B4X:
Dim Serial1 As Serial
Dim testSerial As String

Serial1.Initialize("Serial1")

Try
   testSerial = Serial1.Address
   Available = True
Catch
   Available = False
End Try

Edit: You also need to include the Serial library.
 
Last edited:
Upvote 0

petr4ppc

Well-Known Member
Licensed User
Longtime User
AllyAndroid

Thank you very much AllyAndroid.....it is my mistake, yes your code works

Try
testSerial = Serial1.Address
btAvailable = True
ToastMessageShow("BT is built in", True)
Catch
btAvailable = False
ToastMessageShow("BT is not built in", True)
End Try

Have a good day,
p4ppc
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…