Unify Logo Footer.svg
Unify Applications
Logo
Mobile & Device Actions

Mobile & Device Actions

Logo

5 mins READ

Warning: Native mobile only. Most actions on this page are no-ops on web. They only function inside native mobile apps built with UnifyApps. Web app builders won't see them in the action picker.

Actions at a Glance

Action TypeBuilder LabelPlatformUse When
controlDevicePermissionsControl Device PermissionsNative mobileRequest or check OS permissions (camera, mic, location, notifications)
controlPushNotificationsControl Push NotificationsNative mobileRegister the device for push notifications
updateGeolocationControl User Location → Update GeolocationWeb + MobileCapture device GPS location on demand
manageBiometricsManage BiometricsNative mobileEnroll, revoke, or verify biometric (fingerprint/face) login
mobileUtilsMobile UtilsNative mobilePreload images for the next screen
sendMQTTEventSend MQTT EventWeb + MobilePublish a message to an MQTT broker topic

controlDevicePermissions — Control Device Permissions

Checks or requests an OS-level permission on a native mobile device. The result is written to user context under user.permissions.<type>.allowed — read it via a binding, not a return value.

Parameters

ParameterTypeRequiredDefaultDescription
operation"check" | "request"Optional (optional)"check"check reads the current OS state silently (no dialog). request shows the OS permission prompt. Once permanently blocked, request shows a "Go to Settings" alert instead of a prompt.
permissionType"CAMERA" | "MICROPHONE" | "LOCATION" | "PUSH_NOTIFICATIONS"Optional (optional)"CAMERA"Which OS permission to act on.

Output — User Context Keys

permissionTypeStored underRead via binding
CAMERApermissions.camera.allowed{{ user.permissions.camera.allowed }}
MICROPHONEpermissions.microphone.allowed{{ user.permissions.microphone.allowed }}
LOCATIONpermissions.location.allowed{{ user.permissions.location.allowed }}
PUSH_NOTIFICATIONSpermissions.pushNotifications.allowed{{ user.permissions.pushNotifications.allowed }}

Tip: Pattern: Request a permission first, then bind the dependent feature's visibility to the result in user context. The action fires a dependency change so bindings re-evaluate immediately.

Examples

Request camera permission before scanning

{ "actionType": "controlDevicePermissions", "payload": { "operation": "request", "permissionType": "CAMERA" } } // Then bind the scanner's visibility: // visibility conditions → {{ user.permissions.camera.allowed }} EQUAL true

Check location permission silently

{ "actionType": "controlDevicePermissions", "payload": { "operation": "check", "permissionType": "LOCATION" } }

controlPushNotifications — Control Push Notifications

Registers the current native device for push notifications: requests OS notification permission, obtains the device's push token, and saves it to the backend so the device can receive server-sent pushes.

Parameters

ParameterTypeRequiredDefaultDescription
operation"registerPushNotifications"Optional (optional)"registerPushNotifications"The only supported operation — register this device for push notifications.

Warning: Silent no-op conditions:

Register for push after the user opts in

{ "actionType": "controlPushNotifications", "payload": { "operation": "registerPushNotifications" } }

updateGeolocation — Update Geolocation

Reads the device's current GPS coordinates once and writes them to the user context under context.geography. Works on both web (browser location API) and native mobile. Requires location tracking to be enabled in the interface's advanced settings.

Parameters

This action takes no configurable inputs. It is configured as Control User Location → Update Geolocation in the builder.

Output — User Context

FieldTypeDescription
context.geography.statusstringGRANTED, DISABLED, or USER_DENIED
context.geography.coordinates.latitudenumberLatitude when status is GRANTED
context.geography.coordinates.longitudenumberLongitude when status is GRANTED
context.geography.isMockedbooleanMobile only: true if the GPS is spoofed/mocked

Warning: Fails when location tracking is disabled. The action checks the interface's location tracking setting first. If disabled, it fails with "Location tracking is not enabled" without reading any position. Also fails if permission is denied — but still writes the denied status to user context before failing.

Capture location for a nearby search

// Action: Control User Location → Update Geolocation // (no payload fields needed) // Then bind to the coordinates: {{ user.context.geography.coordinates.latitude }}, {{ user.context.geography.coordinates.longitude }}

manageBiometrics — Manage Biometrics

Enrolls, revokes, or verifies biometric (fingerprint/face) login for the current user on a native mobile device. Throws an error in a plain web browser — this action is mobile-only.

Parameters

ParameterTypeRequiredDefaultDescription
method"enroll" | "revoke" | "verify"Optional (optional)"enroll"enroll: Prompts biometric auth, generates a key pair in the secure enclave, registers the public key with the backend. revoke: Deregisters the device, deletes the key pair — the user must re-enroll to use biometrics again. verify: Prompts biometrics, signs a challenge with the private key, and sends it for backend verification.

Examples

Enable Face ID / fingerprint login

{ "actionType": "manageBiometrics", "payload": { "method": "enroll" } }

Verify biometrics on login

{ "actionType": "manageBiometrics", "payload": { "method": "verify" } }

mobileUtils — Mobile Utils (Preload Media)

Preloads a list of image URLs into the device's cache so the next screens render instantly without visible loading delays. Only available in mobile apps.

Parameters

ParameterTypeRequiredDefaultDescription
operation"preloadMedia"Required (required)The operation type. Currently only preloadMedia is supported.
urlsstring[]Required (required)Array of image URLs to prefetch. Supports bindings. Non-image URLs are skipped with a warning. An empty resolved list counts as success — safe to use with conditionally-empty lists.

Note: Use case: Fire this on onPageLoad of a landing or list screen, passing the image URLs of the next screen's hero images. Navigation to that screen will then render images immediately.

Preload hero images for the next screen

{ "actionType": "mobileUtils", "payload": { "operation": "preloadMedia", "urls": "{{ ds_products['data'].map(p => p.imageUrl) }}" } }

sendMQTTEvent — Send MQTT Event

Publishes a message to an MQTT broker topic. Use it to push real-time commands or data updates to connected devices, other app sessions listening to the same topic, or IoT systems.

Parameters

ParameterTypeRequiredDefaultDescription
topicstringRequired (required)The MQTT topic to publish to (e.g. device/sensor/data). Supports bindings.
messagestring | objectRequired (required)The payload to publish. Objects are serialized to JSON. Supports bindings.
qos0 | 1 | 2Optional (optional)0Quality of service level. 0 = at most once, 1 = at least once, 2 = exactly once.
retainbooleanOptional (optional)falseWhen true, the broker retains the message and delivers it to new subscribers.

Publish a sensor command to a device topic

{ "actionType": "sendMQTTEvent", "payload": { "topic": "devices/{{ row.deviceId }}/commands", "message": { "command": "restart", "timestamp": "{{ Date.now() }}" }, "qos": 1 } }

Common Patterns

Permission Gate Pattern

The canonical pattern for permission-gated features:

  1. Request the permission: Wire controlDevicePermissions with operation: "request" to a button click event.

  2. Read the result from user context: Bind the feature's visibility to {{ user.permissions.camera.allowed }} (or the relevant key). The action fires a dependency change so the binding re-evaluates automatically.

  3. Handle the denied case: Add a visibility condition for the "permission denied" message bound to {{ user.permissions.camera.allowed }} EQUAL false.