PhilipsHue / flutter_reactive_ble

Flutter library that handles BLE operations for multiple devices.
https://developers.meethue.com/
Other
663 stars 326 forks source link

The app can't start the scanning process without location permissions. #658

Closed fufylev closed 1 year ago

fufylev commented 1 year ago

What's wrong:

I set all setting for AndroidManifest in accordance with your example.

<uses-permission android:name="android.permission.INTERNET" />
    <!-- required for API 18 - 30 -->
    <uses-permission
            android:name="android.permission.BLUETOOTH"
            android:maxSdkVersion="30" />
    <uses-permission
            android:name="android.permission.BLUETOOTH_ADMIN"
            android:maxSdkVersion="30" />

    <!-- required for API 23 - 30 -->
    <uses-permission-sdk-23
            android:name="android.permission.ACCESS_COARSE_LOCATION"
            android:maxSdkVersion="30" />
    <uses-permission-sdk-23
            android:name="android.permission.ACCESS_FINE_LOCATION"
            android:maxSdkVersion="30" />

    <!-- API 31+ -->
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-permission
            android:name="android.permission.BLUETOOTH_SCAN"
            android:usesPermissionFlags="neverForLocation" />

However, every time I start the application I see a screen with the following: "Authorise the FlutterReactiveBle example app to use Bluetooth and location", what means that I hit the condition of

case BleStatus.unauthorized:
        return "Authorize the FlutterReactiveBle example app to use Bluetooth and location"

in the file ble_status_screen.dart.

I also tried to set the parameter requireLocationServicesEnabled to false in scanForDevices method in file ble_scanner.dart. Nevertheless, any attempts to reach the scan screen are not successful. But, if I ask for a LOCATION permission and give an access, then the app and scan works normally as requested, all peripherals are on the list.

Are there any solutions on how to bypass LOCATION PERMISSION to work with scan?

To Reproduce Steps to reproduce the behavior:

  1. Install 5.0.3 version
  2. Set all as in an example
  3. Start an app

Expected behavior App starts and scan works without ask for a LOCATION PERMISSION

Smartphone

fufylev commented 1 year ago

What I meant is that I don't want to give an access to the location at all. My app doesn't need a location service, so I want to skip this permission and use the BLE scanner only.

fufylev commented 1 year ago

What I meant is that I don't want to give an access to the location at all. My app doesn't need a location service, so I want to skip this permission and use the BLE scanner only.

On Thu, 15 Dec 2022 at 17:51, Jurgen @.***> wrote:

Have you enabled the permissions on your device itself? (On your phone: "Settings -> Apps -> your_app_name -> permissions")

Without a package like permission_handler https://pub.dev/packages/permission_handler, you probably have to enable this yourself.

— Reply to this email directly, view it on GitHub https://github.com/PhilipsHue/flutter_reactive_ble/issues/658#issuecomment-1353016082, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQJZCFPFDE2RAIBXMNZE5DWNMH4ZANCNFSM6AAAAAAS7KXD5M . You are receiving this because you authored the thread.Message ID: @.***>

Taym95 commented 1 year ago

You can not, ble scanning allows your app to get user location, only in android 12 > you can remove it!