I’m building a complex data field that scans for a BLE peripheral and communicates over NUS after pairing. I need to trigger the system passkey keypad UI so the user can enter the 6-digit code when the device is first paired.
I connect, then call requestBond() from onConnectedStateChanged(). I defer all GATT operations until encryption is up (checked via onEncryptionStatus). Despite this, the Edge does not always show the passkey keypad, even on first-time pair; I sometimes get a quick onEncryptionStatus(STATUS_SUCCESS) without any keypad, or “already bonded” behavior even after removing the sensor from the Sensors list.
I’m looking for the supported way (if any) to reliably surface the passkey keypad from a Data Field context, or confirmation that this flow is not supported and should be done via a Sensor app / Sensors menu instead.
Repro Steps
- Load the data field on an activity page.
- Data field calls BLE.setScanState(SCAN_STATE_SCANNING) and filters on name “My BLE Sensor” and RSSI > –50 dBm.
- On a match, it calls BLE.pairDevice(scanResult).
- In onConnectedStateChanged(CONNECTION_STATE_CONNECTED), it calls _dev.requestBond() (only if not already bonded).
- Waits for onEncryptionStatus. Only after success, schedules deferred NUS discovery and CCCD enable (no GATT before encryption).
- Observe whether the system keypad UI appears to enter the 6-digit code.
Expected
- The system passkey keypad UI appears when requestBond() is called from a Data Field after link-up to a device that requires a passkey.
Actual
- Often no keypad UI is shown. I receive onEncryptionStatus(STATUS_SUCCESS) and/or logs indicating “already bonded; deferring discovery,” but the device can’t be added/paired in a way that lets me communicate reliably from the data field.
- In other attempts (older builds) I saw exceptions if I touched GATT too early — I addressed this with deferred discovery/backoff — but the keypad UI is still inconsistent.
Recent Logs (Edge 1040)
[BLE] scan processed total=1 candidates=0
[BLE] onConnectedStateChanged state=1
[BLE] already bonded; deferring discovery
[BLE] scheduled discovery in 500 ms (attempt 1/10)
[BLE] onEncryptionStatus status=0
[BLE] bonded/encrypted OK → schedule NUS discovery
[BLE] scheduled discovery in 500 ms (attempt 1/10)
What I’ve Already Tried
- Calling requestBond() only after CONNECTION_STATE_CONNECTED.
- Not touching any services/characteristics until onEncryptionStatus(STATUS_SUCCESS).
- Adding delays and retries (discovery backoff) after bonding to avoid “GATT not ready” issues.
- Clearing bonds in Sensors → Remove, power-cycling the peripheral, and retrying.
- Ensured BLE permission in manifest.xml.
- Verified that the flow works to exchange data if the device is already bonded.
Questions
- Is it supported to trigger the system passkey keypad UI from a Data Field via requestBond()?
- If not supported in a Data Field, is there a recommended/official pattern to initiate pairing — e.g., must this be done via a Sensor app and the Sensors menu (Connect IQ sensors) instead?
- Are there firmware/UI constraints on Edge 1040 that suppress the keypad UI when an activity page (with a Data Field) is active?
- Is there any other API or delegate event I should use to explicitly surface the keypad UI for passkey entry from Connect IQ?
- Are there known limitations with pairing/bonding for peripherals that require passkey (6 digits) when initiated from a Data Field?
Sample Code