Skip to content
Stand with Ukraine flag

Configure mobile actions in ThingsBoard Mobile Application

Mobile actions are a special subtype of widget actions that let you trigger native device functions — take a photo, scan a QR code, get the phone’s location, make a phone call, and more. The result of each action is passed to a JavaScript function you configure, so you can process it further — for example, save a photo as an entity attribute or use a scanned QR code to claim a device.

  1. Go to Dashboard groups in the left main menu.
  2. Open the target dashboard group.
  3. Click the dashboard you want to modify.
  4. In the dashboard details panel, click Open dashboard.
  5. Click the Edit (pencil) button in the bottom-right corner to enter edit mode.
  6. Click the Edit (pencil) icon on the target widget to open its settings.
  7. Navigate to the Actions tab.
  8. Click + to add a new action.
  9. In the Type drop-down, select Mobile action.
  10. In the Mobile action type drop-down, select the action type you want.
  11. Configure the JavaScript function with your processing logic. Use the help buttons for function definitions and examples.

Opens the device image gallery so you can select a photo. Returns the selected image as a base64 data URL.

Configure the processImage function to handle the result — for example, store the image as an entity attribute to display it later in widgets.

Opens the device camera to capture a photo. Returns the captured image as a base64 data URL.

Configure the processImage function to handle the result.

Takes a location in latitude/longitude format and opens the available maps app to show directions to that location.

Configure the getLocation function to extract latitude/longitude from entity attributes — for example, to direct you to a field device’s location.

Takes a location in latitude/longitude format and opens the available maps app to display that location on the map.

Configure the getLocation function to extract coordinates from entity attributes.

Opens the QR code scanner. Returns the scanned value.

Configure the processQrCode function to process the result. A common use case is device claiming — the QR code encodes the device name and secret key, which are then used to claim the device. For details, see Claiming devices.

Takes a phone number and opens the appropriate app to initiate a call.

Configure the getPhoneNumber function to extract the number from entity attributes.

Reads the current device location from location services. Returns a latitude/longitude pair.

Configure the processLocation function to handle the result — for example, save the coordinates as entity attributes to update the entity’s position on a map widget.

Captures the current phone screen. Returns the image as a base64 data URL.

Configure the processImage function to handle the result — for example, store the screenshot as an entity attribute.