<< All versions
Skill v1.0.1
currentAutomated scan100/100facebook/meta-wearables-dat-android/sample-app-guide
+2 new
──Details
PublishedSeptember 8, 2026 at 03:08 AM
Content Hashsha256:6d70144a5dcd9c8d...
Git SHA81dfb51b9be2
Bump Typepatch
──Files
Files (1 file, 3.2 KB)
SKILL.md3.2 KBactive
SKILL.md · 120 lines · 3.2 KB
version: "1.0.1" name: sample-app-guide description: Building a complete DAT app with session creation, camera streaming, and photo capture
Sample App Guide (Android)
Build an Android DAT app with registration, sessions, camera streaming, and photo capture.
Pair this with the CameraAccess sample.
Project setup
- Create an Android Studio app project.
- Add the DAT Maven repository and dependencies.
- Configure
AndroidManifest.xmlfor registration callbacks plusAPPLICATION_IDandCLIENT_TOKEN. - Initialize
Wearablesin yourApplication.
Suggested app structure
text
app/src/main/java/com/example/myapp/├── MyApplication.kt├── MainActivity.kt├── session/│ └── SessionViewModel.kt└── ui/├── RegistrationScreen.kt└── CameraScreen.kt
Registration and session creation
kotlin
class MainActivity : ComponentActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)lifecycleScope.launch {Wearables.registrationState.collect { state ->// Update registration UI}}}fun register() {Wearables.startRegistration(this)}}
kotlin
class SessionViewModel : ViewModel() {private var session: Session? = nullprivate var camera: Camera? = nullfun startCameraSession() {val createdSession = Wearables.createSession(AutoDeviceSelector()).getOrElse { error ->throw IllegalStateException(error.description)}createdSession.start()session = createdSessioncamera = createdSession.addCamera(StreamConfiguration(videoQuality = VideoQuality.MEDIUM, frameRate = 24),).getOrElse { error ->throw IllegalStateException(error.description)}.also { addedCamera ->addedCamera.stream.start().getOrElse { error ->throw IllegalStateException(error.description)}}}}
Observe frames and capture photos
kotlin
viewModelScope.launch {camera?.stream?.videoStream?.collect { frame ->// Render preview}}fun capturePhoto() {viewModelScope.launch {camera?.stream?.capturePhoto()?.onSuccess { photoData ->savePhoto(photoData.data)}?.onFailure { error, _ ->showCaptureError(error.description)}}}
Shutdown
kotlin
fun stopCameraSession() {camera?.stop()session?.stop()camera = nullsession = null}
Testing with MockDeviceKit
Use MockDeviceKit to simulate linking glasses, permission state, and camera media without physical hardware. See MockDevice Testing for setup details.