Bluetooth - Android
Invoke functions to scan, pair, and upair to available bluetooth devices from the app.
Last updated
Was this helpful?
Invoke functions to scan, pair, and upair to available bluetooth devices from the app.
Last updated
Was this helpful?
You'll need to import the javascript file in your website before starting from this .
const { Bluetooth } = window.WTN
//To start scanning for bluetooth devices
Bluetooth.startBluetoothScan({
callback: function(data){
//Contains data which has a list of available bluetooth devices
}
})
//To connect bluetooth device with specific address
Bluetooth.pairDevice({
address, //Device address that you want to connect
timeout, //Time till the app should try to connect before returning not paired status
callback: function(data){
//Contains data which has result as PAIRED | NOT_PAIRED
}
})
//To disconnect from the connected bluetooth device
Bluetooth.startBluetoothScan({
address, //Device address that you want to connect
callback: function(data){
//Contains data which has result UNPAIRED | ERROR DURING UNPAIRING
}
})
import { Bluetooth } from "webtonative";
//To start scanning for bluetooth devices
Bluetooth.startBluetoothScan({
callback: function(data){
//Contains data which has a list of available bluetooth devices
}
})
//To connect bluetooth device with specific address
Bluetooth.pairDevice({
address, //Device address that you want to connect
timeout, //Time till the app should try to connect before returning not paired status
callback: function(data){
//Contains data which has result as PAIRED | NOT_PAIRED
}
})
//To disconnect from the connected bluetooth device
Bluetooth.startBluetoothScan({
address, //Device address that you want to connect
callback: function(data){
//Contains data which has result UNPAIRED | ERROR DURING UNPAIRING
}
})