Skip to content

Commit

Permalink
fix(android): handle immediate enable/disable problems
Browse files Browse the repository at this point in the history
  • Loading branch information
pwespi committed Oct 9, 2022
1 parent 2d9afc2 commit a48082d
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,22 @@ class BluetoothLe : Plugin() {
@PluginMethod
fun enable(call: PluginCall) {
assertBluetoothAdapter(call) ?: return
bluetoothAdapter?.enable()
val result = bluetoothAdapter?.enable()
if (result != true) {
call.reject("Enable failed.")
return
}
call.resolve()
}

@PluginMethod
fun disable(call: PluginCall) {
assertBluetoothAdapter(call) ?: return
bluetoothAdapter?.disable()
val result = bluetoothAdapter?.disable()
if (result != true) {
call.reject("Disable failed.")
return
}
call.resolve()
}

Expand Down

0 comments on commit a48082d

Please sign in to comment.