open_earable_flutter 0.1.0
open_earable_flutter: ^0.1.0 copied to clipboard
This package provides functionality for interacting with OpenEarable devices. Control LED colors, control audio, and access raw sensor data.
OpenEarable Flutter #
This Dart package provides functionality for interacting with OpenEarable devices and some other wearables.
Try it online, provided your browser supports Web Bluetooth.
Permissions #
For your app to be able to use UniversalBLE in this package, you need to grant the following permissions:
Android #
You need to add the following permissions to your AndroidManifest.xml file:
<!-- flutter_reactive_ble permissions -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- location permissions -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
If you use location services in your app, remove android:maxSdkVersion="30"
from the location permission tags
iOS / macOS #
For iOS it is required you add the following entries to the Info.plist
file of your app. It is not allowed to access Core BLuetooth without this. See our example app on how to implement this. For more indepth details: Blog post on iOS bluetooth permissions
iOS 13 and higher
- NSBluetoothAlwaysUsageDescription
iOS 12 and lower
- NSBluetoothPeripheralUsageDescription
For macOS, add the Bluetooth capability to the macOS app from Xcode.
Getting Started #
To get started with the OpenEarable Flutter package, follow these steps:
- Installation: Add the package to your flutter project: \
flutter pub add open_earable_flutter
Alternatively, you can follow the instructions on pub.dev
- Import the package:
import 'package:open_earable_flutter/open_earable_flutter.dart';
- Initialize WearableManager
final WearableManager _wearableManager = WearableManager();
- Scan for devices:
_wearableManager.scanStream.listen((scannedDevice) {
// Handle scanned devices
});
_wearableManager.startScan();
- Handle new connections:
// Deal with new connected devices
_wearableManager.connectStream.listen((wearable) {
// Handle new wearable connection
wearable.addDisconnectListener(() {
// Handle disconnection
});
});
- Connect to a device:
_wearableManager.connectToDevice(scannedDevice);