Hi,
There's no built in action to execute a scan since a scan is very heavyweight and can cause interruptions to already connected BT devices.
You can create your own action with action
Script:
Code: Select all
bta=callJavaStaticMethod("android.bluetooth.BluetoothAdapter", "getDefaultAdapter()");
callJavaMethod(bta, "android.bluetooth.BluetoothAdapter", "startDiscovery()")
You can handle the found devices with trigger
General Broadcast. You can use example
Bluetooth Device found as the base configuration but add following line in the
Access intent extras field:
Code: Select all
device = getParcelable("android .bluetooth.device.extra.DEVICE");
The device will contain the address of the device which can be used in action
Connect/Disconnect Bluetooth Device.
According to the documentation you should not attempt to create a connection as long as the discovery process is running so you might have to stop discovery first with another action
Script:
Code: Select all
bta=callJavaStaticMethod("android.bluetooth.BluetoothAdapter", "getDefaultAdapter()");
callJavaMethod(bta, "android.bluetooth.BluetoothAdapter", "cancelDiscovery()")
Entry point for documentation can be found here:
https://developer.android.com/reference ... othAdapter
I hope this helps.
Regards,
Martin