Device
Public surface (device): get · isAtLeastVersion
Both methods run on iOS and Android only. Elsewhere they return null / false (they do not throw).
type AppEnvironment = 'production' | 'staging'
interface DeviceInfo { app: { name: string version: string build: string environment: AppEnvironment } os: { name: string; version: string } hardware: { model: string name: string isPhone: boolean isPad: boolean isSimulator: boolean hasSensorHousing: boolean } orientation: 'portrait' | 'landscape' locale: { region: string }}Get device info
Section titled “Get device info”get(): Promise<DeviceInfo | null>import mobilelocker from '@mobilelocker/javascript-sdk'
const info = await mobilelocker.device.get()if (info) { console.log(info.app.version, info.hardware.model, info.orientation)}// null outside iOS/Android Mobile Locker appsVersion gate
Section titled “Version gate”isAtLeastVersion(version: string): Promise<boolean>// version format: major.minor.patch, e.g. '5.5.0'if (mobilelocker.isApp() && (await mobilelocker.device.isAtLeastVersion('5.5.0'))) { // feature that depends on a specific host version}Returns false when not on iOS/Android, when get() fails to return info, or when the app version is lower.
Combine with Environments (isIOS, isAndroid, isApp) for feature switches.
API reference
Section titled “API reference”- Module:
device - Types:
DeviceInfo,AppEnvironment