RequestEnable

The RequestEnable function invokes system dialog box which could enable Bluetooth on tablet/phone when Bluetooth is disabled. If Bluetooth is enabled, this function doesn't invoke any visible dialog box. Be careful when checking Bluetooth state immediately after this function by calling IsEnabled or IsBluetoothEnabled, while RequestEnable doesn't stop program execution, and there is no SetOnRequestEnabled method called after this function invoke. This function is internally invoked by ShowDevices method when Bluetooth is disabled.

nxt.RequestEnable();

Example - If Bluetooth is not enabled call RequestEnable on app start

function OnStart()
{
  // Create NXT remote controller object.
  var nxt = app.CreateNxt();
  // If Bluetooth is not enabled, then call function which allows to enable it
  if (!nxt.IsBluetoothEnabled()) {
    nxt.RequestEnable();
  }
}