Back

IsBluetoothOn

JS Py
Hello World

Checks if bluetooth is enabled and on.

app.IsBluetoothOn() → Boolean

See Also: CreateBluetoothSerial, DiscoverBtDevices

Example - Check Bluetooth Status

function OnStart()
{
    var status = app.IsBluetoothEnabled()
    var state = app.IsBluetoothOn();

    app.ShowPopup(
        "Bluetooth is " +
        (status ? "enabled" : "disabled") +
        (status == state ? " and " : " but ") +
        (state ? "on" : "off")
    );
}
from native import app

def OnStart():
    status = app.IsBluetoothEnabled()
    state = app.IsBluetoothOn()

    app.ShowPopup(
        "Bluetooth is " +
        ("enabled" if status else "disabled") +
        (" and " if status == state else " but ") +
        ("on" if state else "off")
    )
    Copy     Copy All       Run