flutter_bluetooth_serial icon indicating copy to clipboard operation
flutter_bluetooth_serial copied to clipboard

Why is location access required for accessing Bluetooth?

Open sbis04 opened this issue 4 years ago • 5 comments

Problem summary

The app requires location access every time it is running on the device. I believe Bluetooth doesn't require a location permission.

Steps to reproduce

  1. Open example app
  2. Give permission to turn on Bluetooth
  3. Then Allow flutter_bluetooth to access this device's location? dialog-box appears

Solution

Removing the following line from the AndroidManifest.xml file:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

Environment

flutter --version output from the terminal:

Flutter 1.12.13+hotfix.8 • channel stable •
https://github.com/flutter/flutter.git
Framework • revision 0b8abb4724 (4 weeks ago) • 2020-02-11 11:44:36 -0800
Engine • revision e1e6ced81d
Tools • Dart 2.7.0

sbis04 avatar Mar 12 '20 06:03 sbis04

The permission is required in order to discover (scanning for) other Bluetooth devices by the library. Well, maybe someday it could be optional - I don't think you need it, if you are connecting to fixed address...

Why closed with no message?

AgainPsychoX avatar Mar 12 '20 11:03 AgainPsychoX

Sorry for closing the issue without any message. But I later found out that for discovering as well as for connecting to paired devices also, location permission is required.

But, for the end-user, this seems various suspicious as to "Why a Bluetooth connection should require location access?"

sbis04 avatar Mar 12 '20 13:03 sbis04

Is there a solution for not ask location permission ?

YusufElosman avatar Mar 15 '20 20:03 YusufElosman

There probably is a way, but plugin does not YET implement it. As I mentioned above, the plugin does not "require" the permission, but scanning/discovering devices do. Theoretically, plugin should allow for direct connections to known devices without the permission.

It require some rewrite of platform (Java) code. Feel free to fork and implement it yourself, and then pull request here :)

This issue is recognizable as feature request, so it should stay.

AgainPsychoX avatar Mar 15 '20 21:03 AgainPsychoX

PR submitted here, no need to ask for location permissions if you want to get list of bonded devices.

yanivshaked avatar Nov 09 '21 12:11 yanivshaked