don / cordova-plugin-ble-central

Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Apache License 2.0
941 stars 601 forks source link

Beacon cannot be scanned in Android 12 #981

Closed Coding-Farmer-tao closed 10 months ago

Coding-Farmer-tao commented 10 months ago

hello! I use the slim variant of the plugin (instructions) and remove the android:usesPermissionFlags="neverForLocation",then this application cant scan any device.When i add he android:usesPermissionFlags="neverForLocation", it works fine but cant find beacon.

    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="28" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />
    <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />

thank you!

Coding-Farmer-tao commented 10 months ago

When I install this app on an Android 8 device, it works fine and scans for beacon devices.

peitschie commented 10 months ago

Hi @Coding-Farmer-tao

Are you requesting ACCESS_LOCATION_FINE permissions at runtime? You'll need to do this manually using a plugin such as https://github.com/dpa99c/cordova-diagnostic-plugin

Coding-Farmer-tao commented 10 months ago

that is right,thank you for your reply!