permissions-registration

作成者: facebook

App registration with Meta AI and device permission flows

npx skills add https://github.com/facebook/meta-wearables-dat-android --skill permissions-registration

Permissions & Registration (Android)

Register your app with Meta AI, then request the device permissions it needs.

The DAT SDK separates two steps:

  1. Registration: The user connects your app to Meta AI.
  2. Device permissions: After registration, your app requests capabilities such as camera access.

Both flows depend on the Meta AI app being installed on the phone.

Start registration

Wearables.startRegistration(activity)

Observe registration state:

lifecycleScope.launch {
    Wearables.registrationState.collect { state ->
        // Update your registration UI
    }
}

To unregister:

Wearables.startUnregistration(activity)

Check permission status

checkPermissionStatus(...) is a suspend API that returns a DatResult.

lifecycleScope.launch {
    Wearables.checkPermissionStatus(Permission.CAMERA)
        .onSuccess { status ->
            if (status == PermissionStatus.Granted) {
                startStreaming()
            }
        }
        .onFailure { error, _ ->
            showPermissionError(error.description)
        }
}

Request a permission

Use Wearables.RequestPermissionContract() with the Activity Result API:

private val permissionLauncher =
    registerForActivityResult(Wearables.RequestPermissionContract()) { result ->
        result.onSuccess { status ->
            if (status == PermissionStatus.Granted) {
                startStreaming()
            }
        }.onFailure { error, _ ->
            showPermissionError(error.description)
        }
    }

fun requestCameraPermission() {
    permissionLauncher.launch(Permission.CAMERA)
}

Users can allow once or allow always through the Meta AI flow.

Developer Mode vs production

ModeRegistration behavior
Developer ModeUse mwdat_application_id = 0 and mwdat_client_token = 0 manifest placeholders for local development
ProductionUse the application ID and client token assigned in the Wearables Developer Center

For development builds, enable Developer Mode in the Meta AI app before testing registration and permissions.

Prerequisites

  • Internet connection for registration
  • Meta AI app installed on the phone
  • Callback URI scheme configured in AndroidManifest.xml
  • Bluetooth permission granted on Android

Links

facebookのその他のスキル

api-health
facebook
Monitor API health for a Meta app — check rate limits, call volume, and API deprecations. Use to diagnose throttling, plan capacity, or prepare for API version…
official
api-integration
facebook
Guide a developer through setting up a Meta API integration from scratch — discovers the right APIs, fetches setup guides, authentication requirements,…
official
app-review-prep
facebook
MetaアプリをApp Reviewに備えて準備します — 現在のステータス、未対応の要件、付与済みの権限、提出履歴を確認します。アプリを提出する前に使用してください…
official
debug-webhooks
facebook
Metaアプリのウェブフック問題をトラブルシューティング — アクティブなサブスクリプションを検査し、設定ミスを特定し、テストペイロードを送信して配信を確認します。次の場合に使用…
official
webhook-setup
facebook
Set up webhooks for a Meta app end-to-end — discover available topics, subscribe to fields, and verify with a test payload. Use when configuring webhooks for…
official
buck2-rule-basics
facebook
Guide users through writing their first Buck2 rule to learn fundamental concepts including rules, actions, targets, configurations, analysis, and select(). Use…
official
add-ir-instruction
facebook
Hermesコンパイラに新しいIR命令を追加するためのガイド。ユーザーが新しいIR命令(Inst/Instruction)を追加、作成、または定義するよう求めた場合に使用します…
official
binary-size-analysis
facebook
このスキルは、ユーザーが一連のコミットにわたるhermesvm binary sizeの変更を分析したい場合に使用するべきです。ユーザーが「binary size」に言及した場合に使用してください、…
official