DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


Sidebar

Privacy Policy

News

Version1.42 is out since December 2nd 2016


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

built_in:nxt_requestenable

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();
  }
}
built_in/nxt_requestenable.txt · Last modified: 2015/03/10 15:41 by madlyr