Skip to content

Permissions

Public surface (permissions):
camera · microphone · photoLibrary · location · bluetooth · biometric

Outside iOS, permission helpers return a safe default (they do not throw for wrong environment). Network failures on iOS throw MobileLockerError.

type PermissionStatus =
| 'authorized' | 'authorized_always' | 'authorized_when_in_use'
| 'denied' | 'restricted' | 'not_determined' | 'limited' | 'unknown'
type BiometricType = 'face_id' | 'touch_id' | 'optic_id' | 'none' | 'unknown'
interface PermissionResult {
status: PermissionStatus
granted: boolean
}
interface BiometricResult {
available: boolean
biometric_type: BiometricType
error: string | null
}
camera(): Promise<PermissionResult>
microphone(): Promise<PermissionResult>
photoLibrary(): Promise<PermissionResult>
location(): Promise<PermissionResult>
bluetooth(): Promise<PermissionResult>
// Outside iOS → { status: 'not_determined', granted: false }
import mobilelocker from '@mobilelocker/javascript-sdk'
const camera = await mobilelocker.permissions.camera()
const microphone = await mobilelocker.permissions.microphone()
const photoLibrary = await mobilelocker.permissions.photoLibrary()
const location = await mobilelocker.permissions.location()
const bluetooth = await mobilelocker.permissions.bluetooth()
if (!camera.granted) {
// prompt user via host settings / UI
}

Status notes:

  • Location may use 'authorized_always' / 'authorized_when_in_use'
  • Photo library may use 'limited'
biometric(): Promise<BiometricResult>
// Outside iOS → { available: false, biometric_type: 'unknown', error: null }
const biometric = await mobilelocker.permissions.biometric()
// biometric.available, biometric.biometric_type, biometric.error