Skip to content

Commit 7c7a86c

Browse files
committed
Cleanup README.
1 parent 8952df0 commit 7c7a86c

File tree

1 file changed

+42
-40
lines changed

1 file changed

+42
-40
lines changed

README.md

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,6 @@ Using the FlutterBlue instance, you can scan for and connect to nearby devices (
2727
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)).
2828
The BluetoothDevice object is then used to directly interact with characteristics and descriptors.
2929

30-
## Setup
31-
### Change the minSdkVersion for Android
32-
33-
Flutter_blue is compatible only from version 19 of Android SDK so you should change this in **android/app/build.gradle**:
34-
```dart
35-
Android {
36-
defaultConfig {
37-
minSdkVersion: 19
38-
```
39-
### Add permissions for Bluetooth
40-
We need to add the permission to use Bluetooth and access location:
41-
42-
#### **Android**
43-
In the **android/app/src/main/AndroidManifest.xml** let’s add:
44-
45-
```dart
46-
<uses-permission android:name="android.permission.BLUETOOTH" />
47-
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
48-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
49-
<application
50-
```
51-
#### **IOS**
52-
In the **ios/Runner/Info.plist** let’s add:
53-
54-
```dart
55-
<dict>
56-
<key>NSBluetoothAlwaysUsageDescription</key>
57-
<string>Need BLE permission</string>
58-
<key>NSBluetoothPeripheralUsageDescription</key>
59-
<string>Need BLE permission</string>
60-
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
61-
<string>Need Location permission</string>
62-
<key>NSLocationAlwaysUsageDescription</key>
63-
<string>Need Location permission</string>
64-
<key>NSLocationWhenInUseUsageDescription</key>
65-
<string>Need Location permission</string>
66-
```
67-
68-
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)
6930
## Usage
7031
### Obtain an instance
7132
```dart
@@ -147,6 +108,47 @@ await device.requestMtu(512);
147108
```
148109
Note that iOS will not allow requests of MTU size, and will always try to negotiate the highest possible MTU (iOS supports up to MTU size 185)
149110

111+
## Getting Started
112+
### Change the minSdkVersion for Android
113+
114+
Flutter_blue is compatible only from version 19 of Android SDK so you should change this in **android/app/build.gradle**:
115+
```dart
116+
Android {
117+
defaultConfig {
118+
minSdkVersion: 19
119+
```
120+
### Add permissions for Bluetooth
121+
We need to add the permission to use Bluetooth and access location:
122+
123+
#### **Android**
124+
In the **android/app/src/main/AndroidManifest.xml** let’s add:
125+
126+
```xml
127+
<uses-permission android:name="android.permission.BLUETOOTH" />
128+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
129+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
130+
<application
131+
```
132+
#### **IOS**
133+
In the **ios/Runner/Info.plist** let’s add:
134+
135+
```dart
136+
<dict>
137+
<key>NSBluetoothAlwaysUsageDescription</key>
138+
<string>Need BLE permission</string>
139+
<key>NSBluetoothPeripheralUsageDescription</key>
140+
<string>Need BLE permission</string>
141+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
142+
<string>Need Location permission</string>
143+
<key>NSLocationAlwaysUsageDescription</key>
144+
<string>Need Location permission</string>
145+
<key>NSLocationWhenInUseUsageDescription</key>
146+
<string>Need Location permission</string>
147+
```
148+
149+
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)
150+
151+
150152
## Reference
151153
### FlutterBlue API
152154
| | Android | iOS | Description |
@@ -182,6 +184,6 @@ Note that iOS will not allow requests of MTU size, and will always try to negoti
182184
| write | :white_check_mark: | :white_check_mark: | Writes the value of the descriptor. |
183185

184186
## Troubleshooting
185-
### Scanning for service UUID's doesn't return any results
187+
### When I scan using a service UUID filter, it doesn't find any devices.
186188
Make sure the device is advertising which service UUID's it supports. This is found in the advertisement
187189
packet as **UUID 16 bit complete list** or **UUID 128 bit complete list**.

0 commit comments

Comments
 (0)