SL4A API Help -BluetoothFacade

index
Bluetooth functions.
Min SDK level=5
bluetoothAcceptListens for and accepts a Bluetooth connection. Blocks until the connection is established or fails.
uuid (String) (default=457807c0-4897-11df-9879-0800200c9a66)
timeout (Integer) How long to wait for a new connection, 0 is wait for ever (default=0)
bluetoothActiveConnectionsReturns active Bluetooth connections.
bluetoothConnectConnect to a device over Bluetooth. Blocks until the connection is established or fails.
uuid (String) The UUID passed here must match the UUID used by the server device. (default=457807c0-4897-11df-9879-0800200c9a66)
address (String) The user will be presented with a list of discovered devices to choose from if an address is not provided. (optional)
returns: (String) True if the connection was established successfully.
bluetoothDiscoveryCancelCancel the current device discovery process.
returns: (Boolean) true on success, false on error
bluetoothDiscoveryStartStart the remote device discovery process.
returns: (Boolean) true on success, false on error
bluetoothGetConnectedDeviceNameReturns the name of the connected device.
connID (String) Connection id (optional) (default=)
bluetoothGetLocalAddressReturns the hardware address of the local Bluetooth adapter.
bluetoothGetLocalNameGets the Bluetooth Visible device name
bluetoothGetRemoteDeviceNameQueries a remote device for it\'s name or null if it can\'t be resolved
address (String) Bluetooth Address For Target Device
bluetoothGetScanModeGets the scan mode for the local dongle.\r
Return values:\r
\t-1 when Bluetooth is disabled.\r
\t0 if non discoverable and non connectable.\r
\r1 connectable non discoverable.\r3 connectable and discoverable.
bluetoothIsDiscoveringReturn true if the local Bluetooth adapter is currently in the device discovery process.
bluetoothMakeDiscoverableRequests that the device be discoverable for Bluetooth connections.
duration (Integer) period of time, in seconds, during which the device should be discoverable (default=300)
bluetoothReadRead up to bufferSize ASCII characters.
bufferSize (Integer) (default=4096)
connID (String) Connection id (optional) (default=)
bluetoothReadBinaryRead up to bufferSize bytes and return a chunked, base64 encoded string.
bufferSize (Integer) (default=4096)
connID (String) Connection id (optional) (default=)
bluetoothReadLineRead the next line.
connID (String) Connection id (optional) (default=)
bluetoothReadReadyReturns True if the next read is guaranteed not to block.
connID (String) Connection id (optional) (default=)
bluetoothSetLocalNameSets the Bluetooth Visible device name, returns True on success
name (String) New local name
bluetoothStopStops Bluetooth connection.
connID (String) Connection id (optional) (default=)
bluetoothWriteSends ASCII characters over the currently open Bluetooth connection.
ascii (String)
connID (String) Connection id (default=)
bluetoothWriteBinarySend bytes over the currently open Bluetooth connection.
base64 (String) A base64 encoded String of the bytes to be sent.
connID (String) Connection id (optional) (default=)
checkBluetoothStateChecks Bluetooth state.
returns: (Boolean) True if Bluetooth is enabled.
toggleBluetoothStateToggle Bluetooth on and off.
enabled (Boolean) (optional)
prompt (Boolean) Prompt the user to confirm changing the Bluetooth state. (default=true)
returns: (Boolean) True if Bluetooth is enabled.

index