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
- Register
IWifiP2PClientListenerduringonCreate/init. - Call
initialize()to bring P2P infra online. - Call
startDiscoverPeers(). - In
onPeersAvailable(), keep devices whose names includeGlass3_. - After user intent, call
connectDevice(). - Persist the resulting
WifiP2pDevicemetadata 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.