Listen for events
Most native features return their result on an event. Use bdk.on(event, listener) to subscribe.
Subscribe to an event
Register a listener for a native event. The payload is typed from the event name (see BdkNativeEvents). Subscribe right after createBdkNative() so you don't miss a result. bdk.on returns an unsubscribe function — call it on unmount.
Get the result of a call
Subscribe before you call the method. Awaiting the call confirms it was dispatched, not that it succeeded — the result arrives on the event. Some events fire quickly (photos, barcode, location, pickers, popups, contacts, screenshots); others may resolve much later or never (purchases, receipts, biometrics, Smart Login).
iap.purchaseIos / purchaseAndroid take { id, type }, where type is "product" or "subscription". Match these key names exactly — they are the native contract.
All events and payloads
Every event and the payload its listener receives. The field-level shape of each object is in Objects.
| Event | Listener receives |
|---|---|
deviceInfo | BdkDeviceInfo |
photoSelected / photoCaptured | MediaResult |
audioRecorded | MediaResult |
screenshot | the captured screenshot image (a data URI you can preview or upload) |
barcodeScanned | the scanned code: its type and decoded content |
contacts | the device address book: each contact's name, phone numbers, and emails |
location | the device location: latitude, longitude, address |
backgroundLocationEnabled | { enabled, alreadyRunning, reason } |
backgroundLocationDisabled | { enabled } |
deviceVariable | { name, data } |
menuClicked | the menu item the user tapped |
popupClosed | which button dismissed the popup |
datePicked | the date/time the user selected |
optionPicked | the option the user chose |
backButtonPressed | undefined |
biometricResult | { data, status, platform } |
smartLoginCredentials | { email, password } |
purchaseSuccess / purchaseFailed | { platform, data } |
receiptReceived | { platform, data } |
error | BdkError |
Handle errors
A throwing listener doesn't break the others. Catch errors centrally via the error event or the onError config callback — both receive a BdkError.