Extension Suggestion: Switch on Bluetooth and Location

Users of Bluetooth (e.g., for sharing data with a microcontroller) Need their App to:

  1. Switch on Bluetooth
  2. Switch on Location (Classic Bluetooth) or Fine Location (BLE)

Extension : Send message/documents via Bluetooth (FAST) || OPEN SOURCE - Extensions - MIT App Inventor Community
Will not this work :thinking: :thinking:

My extension:

It is true that you cannot turn on the location, but you can check if the location is turned on, if not, you can use the ActivityStarter to open the location settings screen.

android.settings.LOCATION_SOURCE_SETTINGS

This extension to check if the Bluetooth is enabled :grin:

1 Like

Isn't there any extension to switch on bluetooth :no_mouth:?

If not then I will publish this little extension,
com.oseamiya.bluetooth.aix (5.3 KB)
(There are three blocks, one is to trigger bluetooth, another to check if device has bluetooth support or not and another is check if bluetooth is enabled or not

Permissions should be 'android.permission.BLUETOOTH_ADMIN' and 'android.permission.BLUETOOTH'

Unfortunately Activity Starter often fails with that setting - possibly because of the Android customisation by the device manufacturer. It can also take a variable amount of time and thus make the User experience of an App confusing.

If we had at least an extension method to open the location settings screen I think it would be more consistent.

Hi everyone, there are several extensions that switch on Bluetooth and that does also work via Activity Starter comfortably.

The idea, as explained, is to handle both settings required for BT to work.

You mean they are not able to Enable Bluetooth Low Energy Functions?

Without Location switched on, bluetooth does not work. This is a Google Android Security feature. BLE requires Fine Location (Could be Android Version dependant as to whether 'fine' is even available).

I will google for the appropriate method and add it to the extension. Although ActivityStarter should work on all devices. Unless some Huaweie that are not compatible with google do not support everything.

Activity Starter does work on all devices but that particular activity creates User interface issues on some devices - Huawei not guilty...... Samsung most prevalent, then lesser makes such as Redmi and Alcatel. Probably depends on device model and Android Version. Not sure really why Google make Location so inaccessible if they want Apps to use it.

Location API is a part of Play Services which can do this thing.

This Activity works fine on my samsung S8.

I think it works fine on several Samsung Models, but is not fine on several others.

Aha - that is the baby! It's worth noting that the nrf BLE App does deal with Switching on Bluetooth and Location elegantly. We want to match that.

Sorry, couldn't understand that.

Such extension is possible but will need Bluetooth_Admin permission

1 Like

I built the extension, here is the aix for bluetooth Toggle

BluetoothToggle.aix (5.1 KB)

Kindly test and tell if it works

PS: Don't forget to use Bluetooth_Admin permission : )

3 Likes

nrf Nordic Semi conductor, the developers of an App for BLE (they make microcontrollers, some similar to Arduino but mostly industry standard).

Sorry Know_About_IT, there are already several extensions for Bluetooth, see the Specification for the Extension required above.