DroidScript / Docs

DroidScript Documentation
Apache License 2.0
85 stars 31 forks source link

Python example IsBtDevice Paired #221

Open Al4He6 opened 4 months ago

Al4He6 commented 4 months ago

Python Example - Check Paired gives error uncaught devices probable needs device = app.IsBtDevic https://github.com/DroidScript/Docs/blob/63145db940b0ace9ef88855f7e3a4ec9c6c4576c/files/markup/en/app/IsBtDevicePaired.js#L136 This seems to work

from native import app

def OnStart(): app.ShowProgress("enabling Bluetooth") app.SetBluetoothEnabled(True) while not app.IsBluetoothOn(): app.Wait(0.2) app.HideProgress()

devices = app.GetPairedBtDevices()

if devices:
    paired = app.IsBtDevicePaired(devices[0].name)
    app.Alert(paired, devices[0].name + " paired")
else:
    app.ShowPopup("No Paired devices found")