chipweinberger / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android, iOS, macOS
Other
726 stars 442 forks source link

[Help]: What if i just want to know if the bluetooth enabled or not what permissions should i put in android manifest #973

Closed shehabmohamed0 closed 3 weeks ago

shehabmohamed0 commented 3 weeks ago

Requirements

Have you checked this problem on the example app?

Yes

FlutterBluePlus Version

1.32.12

Flutter Version

3.24.0

What OS?

Android

OS Version

for all version

Bluetooth Module

Don't know

What is your problem?

What if i just want to know if the bluetooth enabled or not what permissions should i put in android manifest, and should i put uses-feature ?

Logs

_
chipweinberger commented 3 weeks ago

not sure

tnc1997 commented 3 weeks ago

Hi @shehabmohamed0, if I am understanding your question correctly, you would like know the Android permissions that are required in order to get the state of adapter, which allows you to determine whether Bluetooth is on/off.

FlutterBluePlus.adapterState.listen(
  (adapterState) {
    if (adapterState == BluetoothAdapterState.on) {

    }
  },
);

For apps targeting Build.VERSION_CODES#R (API level 30) or lower, this requires the Manifest.permission#BLUETOOTH permission which can be gained with a simple manifest tag:

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />