Monday 22 January 2018

Bluetooth Extension

    Description

    Bluetooth extension.
    Minimum API version for this extension is API version 18, which is Android 4.3 (Jelly Bean MR2).
    Required permission: android.permission.BLUETOOTH_ADMIN, android.permission.BLUETOOTH, android.permission.ACCESS_COARSE_LOCATION, android.permission.READ_EXTERNAL_STORAGE

    Properties

     
    Get DisplayRSSI, i.e. whether RSSI (Received Signal Strength Indication) should be displayed after Scanning.
    Thank you Merciful for being the sponsor of this functionality.
     
    Set DisplayRSSI, i.e. whether RSSI (Received Signal Strength Indication) should be displayed after Scanning.
    Thank you Merciful for being the sponsor of this functionality.

    Methods


    Get Bluetooth state.
    Possible values: Bluetooth off, Turning Bluetooth off, Bluetooth on, Turning Bluetooth on, Unknown.

    Enable Bluetooth without user interaction!

    Note: According to the Android documentation, Bluetooth should never be enabled without direct user consent. If you want to turn on Bluetooth in order to create a wireless connection, you should use the ACTION_REQUEST_ENABLE Intent, which will raise a dialog that requests user permission to turn on Bluetooth, see also this snippet.

    Disable Bluetooth

    Returns Bluetooth MAC address

    Scan Bluetooth devices.
    Caution: Performing device discovery is a heavy procedure for the Bluetooth adapter and will consume a lot of its resources. If you already hold a connection with a device, then performing discovery can significantly reduce the bandwidth available for the connection, so you should not perform discovery while connected.

    Pair Bluetooth device. You will have to accept the connection on the other device manually.
    This is currently an experimental block.

    Unpair Bluetooth device.

    Events


    Event indicating that the bluetooth state changed.
    Possible values: Bluetooth off, Turning Bluetooth off, Bluetooth on, Turning Bluetooth on, Unknown.

    Event indicating that Scanning has finished.
    As result two lists will be provided, a list with already paired devices and a list with new devices.

    Event indicating that Pairing has finished.

    Event indicating that Unpairing has finished.

    Event indicating that an error occurred.

    Example App: Bluetooth Extension Test

  • Download AIA
  • Download APK

No comments:

Post a Comment