Skip to content

Wi‑Fi P2P only

Purpose

Demonstrate standalone Glass discovery and Wi‑Fi Direct attach without running the combined wizard.

Entry point

Example screen:

  • com.rokid.phone.ui.WifiP2PSettingActivity

Platform

  • Phone

Main files

Flow

  1. Register IWifiP2PClientListener during onCreate/init.
  2. Call initialize() to bring P2P infra online.
  3. Call startDiscoverPeers().
  4. In onPeersAvailable(), keep devices whose names include Glass3_.
  5. After user intent, call connectDevice().
  6. Persist the resulting WifiP2pDevice metadata for later reconnects.

SDK surface exposed

  • Wi‑Fi Direct init / teardown
  • Peer scan
  • Attach + status listeners

Notes for developers

Compared with the unified pairing sheet

Ideal when you already have Bluetooth for control-plane work and merely need Direct for bulk transport or streams—easy to refactor out of production apps.

Caveats

  • Matching delegates to DeviceLinkerManager.getDeviceName().
  • Scanning refuses to continue if WLAN stays disabled (toast only).
  • Always persist bonded peer metadata; auto reconnect depends on it.