meta_wearables_flutter 0.1.1
meta_wearables_flutter: ^0.1.1 copied to clipboard
A Flutter plugin for Meta Wearables Device Access Toolkit (MWDAT).
meta_wearables #
A Flutter plugin for the Meta Wearables Device Access Toolkit (MWDAT). Access Meta Ray-Ban glasses camera streaming, photo capture, display content rendering, audio routing, mock device interactions, and registration from Flutter — on both Android and iOS.
Features Table #
| Feature | Supported | Description |
|---|---|---|
| SDK Initialization | ✅ | Link application with Wearables SDK |
| Device Registration | ✅ | Authenticate your app across Meta App |
| Live Camera Streaming | ✅ | Access live MJPEG camera feed from glasses |
| Photo Capture | ✅ | Capture full-resolution photographs |
| Send Display Content | ✅ | Push Text/Images to internal displays (Display glasses only) |
| Audio Routing (Bluetooth) | ✅ | A2DP audio logic routing via glasses speaker |
| Mock Device Kit | ✅ | Run tests and debug locally without physical glasses |
Example Usage #
Here is a quick example of how you can utilize the most common plugin features:
import 'package:flutter/material.dart';
import 'package:meta_wearables_flutter/meta_wearables_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// 1. Initialize the SDK
await MetaWearables.initialize();
// 2. Discover / Check Registration State
MetaWearables.registrationState.listen((state) {
if (state == RegistrationState.registered) {
print("Device is successfully registered!");
}
});
// 3. Connect Camera & Listen to Stream
final stream = await MetaWearables.startCameraStream(
config: const StreamConfiguration(
videoQuality: VideoQuality.high,
frameRate: FrameRate.fps30,
),
);
// Capture a snapshot frame
final photo = await stream.capturePhoto();
// 4. Send Content (For Meta Display Glasses only)
final sessionId = await MetaWearables.createSession();
final displayId = await MetaWearables.addDisplay(sessionId);
await MetaWearables.sendDisplayContent(displayId, "Success", "Streaming active");
}
Prerequisites #
- A Meta AI app installed on the user's phone paired with Ray-Ban Meta glasses
- Your app registered at wearables.developer.meta.com
Installation #
Add the plugin to your pubspec.yaml:
dependencies:
meta_wearables_flutter: ^0.1.0
Android setup #
1. Add the MWDAT Maven repository
Because MWDAT uses a GitHub Packages repository, add the maven block. For Kotlin-based builds (newer Flutter templates), add this inside the allprojects { repositories { ... } } block in the app's android/build.gradle.kts:
allprojects {
val localProperties = java.util.Properties()
val localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.inputStream().use { localProperties.load(it) }
}
val githubToken = System.getenv("GITHUB_TOKEN") ?: localProperties.getProperty("github_token") ?: ""
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/facebook/meta-wearables-dat-android")
credentials {
username = ""
password = githubToken
}
}
}
}
Note: Make sure local.properties contains github_token="..." with your Github Personal Access Token, or run Flutter with the GITHUB_TOKEN environment variable.
2. Update AndroidManifest.xml
In android/app/src/main/AndroidManifest.xml:
<manifest>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.INTERNET" />
<application>
<!-- Without Developer Mode, these values need to be set with credentials -->
<!-- Use 0 or empty string for testing Developer mode -->
<meta-data android:name="com.meta.wearable.mwdat.APPLICATION_ID" android:value="0" />
<meta-data android:name="com.meta.wearable.mwdat.CLIENT_TOKEN" android:value="0" />
<meta-data android:name="com.meta.wearable.mwdat.DAM_ENABLED" android:value="true" />
<!-- Replace metawearablesexample with your unique URL scheme -->
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="metawearablesexample" />
</intent-filter>
</activity>
</application>
</manifest>
iOS setup #
Since the plugin distributes the SDK dynamically via Cocoapods/Swift Package Manager, simply add meta_wearables to your flutter app.
Then update your ios/Runner/Info.plist:
<key>MWDAT</key>
<dict>
<key>AppLinkURLScheme</key>
<string>metawearablesexample://</string>
<key>MetaAppID</key>
<string>YOUR_APP_ID</string>
<key>ClientToken</key>
<string>YOUR_CLIENT_TOKEN</string>
<key>TeamID</key>
<string>YOUR_APPLE_TEAM_ID</string>
<key>DAMEnabled</key>
<true/>
</dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array><string>metawearablesexample</string></array>
</dict>
</array>
<key>UISupportedExternalAccessoryProtocols</key>
<array><string>com.meta.ar.wearable</string></array>
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-peripheral</string>
<string>external-accessory</string>
</array>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Needed to connect to Meta glasses</string>
Supported devices #
- Ray-Ban Meta (Gen 1 & Gen 2)
- Oakley Meta HSTN
- Ray-Ban Meta Display (camera + display)
Links & References #
- Website: My Website