App Inventor Extensions


Classic Bluetooth Extension

See the App Inventor Extensions document about how to use an App Inventor Extension.

For questions about this extension or bug reports please start a new thread in the App Inventor Extensions forum. Thank you.

For feature requests please contact me by email. To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.

Nov 6th, 2016: Version 1: initial version

Jul 17th, 2017: Version 2: property DisplayRSSI added

Jul 23th, 2017: Version 2a: new build using extension-specific directory in aix file

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



Questions and Answers

Q1: It's too long for search for devices, it lasts 60 seconds. It is possible to make search of devices with timing in seconds? For example to search for devices produced 3 seconds or 5 seconds so that the user himself could choose the time of search the Bluetooth devices.
A: Unfortunately this is not possible. The scan process takes its time. Also performing device discovery is a heavy procedure for the Bluetooth adapter and will consume a lot of its resources. Probably the Bluetooth Low Energy Extension by MIT offers a faster scan method. You might want to check...

Q2: When the Bluetooth device is connected to the phone, search TaifunBluetooth will no longer see the device. Is it possible to fix it?
A: If you are already connected, there is no need to scan for the same device, is it? Also 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.

Do you need help with your App Inventor project?

I can help you: for one hour I charge 25 USD.
Please contact me at info [at] puravidaapps [dot] com for details!
For questions about App Inventor, please use the App Inventor forum. Thank you.

Test the functionality of the Bluetooth extension

The test app is available in Google Play for Beta testers. You can test the example following these steps

  1. Join the Taifun Test Google+ Group to be able to test the example app
  2. Then follow the opt-in URL to get access to the app and to be able to download it to your device. It might take a few hours for Google to enable you as beta tester!
  3. Start testing.

Buy the Bluetooth extension for App Inventor


You can buy this extension (aix file).
With your payment you accept the terms and conditions below.

Payment options

1. Paypal

Please transfer 10 USD via Paypal
to Pura Vida Apps

2. Bitcoin

After having received your payment I will be happy to send the extension (aix file) to you.
Thank you! Taifun


Please check your spam folder in case you did not receive the extension!
I usually will send the extension not later than 24 hours after having received your payment.

 

Terms and Conditions

Back to top of page ...


Home | Snippets | Tutorials | Extensions | News | Forums | Links | Search | Contact