From 34665b91f4f8bde0438e3c2c570f65d4c72031d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Dup=C3=A9r=C3=A9?= Date: Thu, 13 Aug 2020 03:13:43 -0400 Subject: [PATCH] Update README.md (#573) Add setup info --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index b4f611a3..44db6147 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ FlutterBlue is a bluetooth plugin for [Flutter](http://www.flutter.io), a new mo This library is actively developed alongside production apps, and the API will evolve as we continue our way to version 1.0. **Please be fully prepared to deal with breaking changes.** +**This package must be tested on a real device.** Having trouble adapting to the latest API? I'd love to hear your use-case, please contact me. @@ -26,6 +27,45 @@ Using the FlutterBlue instance, you can scan for and connect to nearby devices ( Once connected to a device, the BluetoothDevice object can discover services ([BluetoothService](lib/src/bluetooth_service.dart)), characteristics ([BluetoothCharacteristic](lib/src/bluetooth_characteristic.dart)), and descriptors ([BluetoothDescriptor](lib/src/bluetooth_descriptor.dart)). The BluetoothDevice object is then used to directly interact with characteristics and descriptors. +## Setup +### Change the minSdkVersion for Android + +Flutter_blue is compatible only from version 19 of Android SDK so you should change this in **android/app/build.gradle**: +```dart +Android { + defaultConfig { + minSdkVersion: 19 +``` +### Add permissions for Bluetooth +We need to add the permission to use Bluetooth and access location: + +#### **Android** +In the **android/app/src/main/AndroidManifest.xml** let’s add: + +```dart + + + + + NSBluetoothAlwaysUsageDescription + Need BLE permission + NSBluetoothPeripheralUsageDescription + Need BLE permission + NSLocationAlwaysAndWhenInUseUsageDescription + Need Location permission + NSLocationAlwaysUsageDescription + Need Location permission + NSLocationWhenInUseUsageDescription + Need Location permission +``` + +For location permissions on iOS see more at: [https://developer.apple.com/documentation/corelocation/requesting_authorization_for_location_services](https://developer.apple.com/documentation/corelocation/requesting_authorization_for_location_services) ## Usage ### Obtain an instance ```dart