Device & lifecycle
Read device info and control the native app shell — loading splash, navigation, the launch page, and cache.
Read device info
Get device facts like playerId, deviceOS, versionName, or a permission status. createBdkNative() requests device info on init — read it with getDeviceInfo(), await bdk.ready(timeoutMs), or the deviceInfo event.
bdk.getDeviceInfo() returns the latest BdkDeviceInfo, or null if it hasn't arrived yet (for example, in a plain browser or before the first deviceInfo event).
BdkDeviceInfo fields (each string or null unless noted):
Wait for the value with await bdk.ready(timeoutMs), or subscribe to the deviceInfo event — at startup and after a permission prompt.
Detect the native app
Check whether your page is running inside the native app. Branch on it to enable native-only UI or fall back to web behavior.
bdk.isNative() returns true once device info is available, false otherwise.
isNative() reads false until device info arrives, so a check at page load takes the web branch even inside the app. await bdk.ready(timeoutMs) first — it resolves as soon as the device reports in, or null at the timeout — then branch.
Hide the loading splash
Dismiss the loading splash once your page is ready. Use this in "manual" mode to control exactly when the UI appears; with the default removeLoading: "automatic" you don't need to call it.
bdk.app.removeLoading().
Restyle the loading splash
Change the appearance of the loading splash.
bdk.app.updateLoading(options). Recognized LoadingScreenOptions keys: splash_layer_url, splash_layer_width, splash_layer_top, splash_layer_left, and splash_section_background.
Go back
Navigate back, the equivalent of the native back action.
bdk.app.goBack().
Change the launch page
Set which URL the app opens on next launch, then clear it when done.
bdk.app.setLaunchPage(options) sets the alternate launch URL. bdk.app.resetLaunchPage() removes the override and restores the default.
Vibrate the device
Trigger device haptics.
bdk.device.vibrate(options?).
Read the device contacts
Fetch the device address book. Ask for the contacts permission first. For structured results and paging, use contacts.list.
bdk.device.getContacts().
The device address book arrives on the contacts event — an array of contacts, each with a name, phone number(s), and email(s) — not in the returned promise. Subscribe before you call.
Save and read cache values
Persist small values in native storage and read them back later — handy for flags like onboarding state.
bdk.device.saveToCache(options) and bdk.device.getFromCache(options).
The cached value arrives on the deviceVariable event as a DeviceVariableResult with the variable's name and its stored data value, not in the returned promise. Subscribe before you read. If the key was never stored, data is null.
Lifecycle events reference
Subscribe with bdk.on(event, listener), which returns an unsubscribe function. The events:
deviceInfo→BdkDeviceInfo. The shell reported device info; also feedsgetDeviceInfo()andready().contacts. The device address book fromdevice.getContacts()— an array of contacts, each with a name, phone number(s), and email(s).deviceVariable→DeviceVariableResultwith the variable'snameand its storeddatavalue. A cached value fromdevice.getFromCache(...).backButtonPressed→undefined. The hardware back button was pressed.
If a listener throws, the error surfaces once as a BdkError with code BDK_LISTENER_ERROR, delivered to your onError config callback and the error event.
Pick a contact
Open the system contact picker. It does not prompt for address-book permission. On iOS, pass multiple: true to pick more than one.
Each item is a BdkContact with structured phones and emails.
This feature can be switched off in a given app build — check await bdk.capabilities.has("contacts.picker") before showing the picker. See Detect features. If the feature is off, the call throws.
List contacts
Read a page of the device address book. This needs contacts permission; the picker above does not. Native accepts limit 1–200 and pages with offset; the result has access (full or limited), total, hasMore, and nextOffset.
Check await bdk.capabilities.has("contacts.book") before showing the list. If the feature is off, the call throws.