Flutter
To integrate the Aidlab Flutter SDK, follow these steps:
1. Install Flutter
If you haven't already, you need to install Flutter on your computer. Follow the installation guide on the official Flutter website: Flutter Installation Guide.
2. Open Terminal
After installing Flutter, open a terminal on your computer.
3. Create a New Flutter Project
Use the flutter create project_name
command, where project_name
is the name you want to give your project. For example:
flutter create my_project
This command creates a new Flutter project in the my_project directory with a basic app structure.
4. Navigate to Your Project Directory
Change into your project's directory using the cd command:
cd my_project
5. Add aidlab_sdk
Library
Inside your project directory, use the flutter pub add aidlab_sdk command to add the aidlab_sdk library to your project:
flutter pub add aidlab_sdk
This command automatically adds aidlab_sdk
as a dependency in your project's pubspec.yaml
file and updates the dependencies.
6. Configure Bluetooth Permissions
To connect with Aidlab, location permissions must be granted, and Bluetooth must be enabled. Aidlab Flutter SDK does not manage permissions or Bluetooth status checks.
On iOS
For iOS, you need to add the "Privacy - Bluetooth Always Usage Description" key to your info.plist file, located in <project root>/ios/Runner/Info.plist
. This is necessary to ensure your app has permission to access Bluetooth. Add the following entry:
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Your custom message explaining why your app needs Bluetooth access.</string>
Replace "Your custom message explaining why your app needs Bluetooth access." with the appropriate message that describes why your app requires Bluetooth access.
On Android
Modify your AndroidManifest.xml
to include necessary permissions and features for Bluetooth communication:
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
Run Your Application
With the dependencies added and permissions configured, you can now run your application on an emulator or physical device using:
flutter run
Ensure you have Flutter environment and either an emulator or physical device configured for testing your application.