Bluetooth in Discoverable Mode

synasir

Member
Licensed User
Longtime User
I have this coding using intent but is getting the "no activity found to handle intent" error message in the log. I have added the phone library

Dim Intent1 As Intent


Intent1.Initialize("BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE", "")
Intent1.PutExtra("BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION",600)
StartActivity(Intent1)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You do not need to add the Phone library (assuming you are using B4A v1.6 or 1.7).

BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE is a java constant. You should use the actual value which is:
android.bluetooth.adapter.action.REQUEST_DISCOVERABLE

Same is true for the other constant.
You can find the values here: BluetoothAdapter | Android Developers
 
Upvote 0

synasir

Member
Licensed User
Longtime User
Thanks Erel. That works! Anyway I can disable the request permission dialog. I have added the necessary settings in the manifest.
 
Upvote 0
Top