DroidScript / Docs

DroidScript Documentation
Apache License 2.0
80 stars 29 forks source link

Bluetooth Example Check Paired #159

Open Al4He6 opened 2 months ago

Al4He6 commented 2 months ago

Example for Check Paired (Bluetooth) needs line devices = CreateBluetoothList()

Al4He6 commented 1 month ago

This is for Example - Check Paired in Docs for IsBtDevicePaired Javascript https://github.com/DroidScript/Docs/blob/63145db940b0ace9ef88855f7e3a4ec9c6c4576c/files/markup/en/app/IsBtDevicePaired.js#L29 This seems to run

function OnStart() { app.ShowProgress( "enabling Bluetooth" ); app.SetBluetoothEnabled( true ); while( !app.IsBluetoothOn() ) app.Wait( 0.2 ); app.HideProgress();

devices = app.CreateBluetoothList(  )

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

}