IBluetooth State Callback
IBluetoothStateCallback
Description :
This interface represent the API for all event related to Bluetooth connection state. * This interface is used with the STWBluetoothStateManager in order to delegate event linked to classic bluetooth.
This class offers several possible callback defined in the following list :
- Bluetooth turn on/off
- Bluetooth Device connexion state Connected/Disconnected
Example of use :
- Implementation :
IBluetoothStateCallback mBluetoothStateCallback = new IBluetoothStateCallback() { public void onBluetoothTurnedOff() { //code... } public void onBluetoothTurnedOn() { //code... } public void onDeviceConnected(String bluetoothDeviceAddress) { //code... } public void onDeviceDisconnect(String bluetoothDeviceAddress) { //code... } }Content copied to clipboard - Registration :
STWBluetoothStateManager.getInstance.registerForBluetoothStateCallback(mBluetoothStateCallback)Content copied to clipboardContent copied to clipboardContent copied to clipboard - UnRegister :
STWBluetoothStateManager.getInstance.unregisterForBluetoothStateCallback(mBluetoothStateCallback)Content copied to clipboard
Functions
Link copied to clipboard
Callback triggered when Bluetooth Turned off event.
Link copied to clipboard
Callback triggered when Bluetooth Turned on event.
Link copied to clipboard
Callback triggered when new device Connected.
Link copied to clipboard
abstract fun onDeviceDisconnect(@Nullable bluetoothDeviceAddress: String)
Content copied to clipboard
Callback triggered when Bluetooth device is disconnecting.