Native Mobile Utils API

Utils External Object

"SmartDevicesPlusUtil" is an External Object that contains methods than can be used to simplify some tasks that are necessary in most projects. This External Object is imported into the Knowledge Base when you run the "Design System Wizard" and will be available so you can easily use it:



This method lets the user take a screenshot with a specific width and height so you can customize the resolution of the image. If the width and height are left in 0, the image from the screenshot will have the resolution of the device.

If you set whether the width or the height (and leave the other value in 0) the image from the screenshot will be adjusted to keep the proper resolution.


This method let convert an image to Base64.


This method let convert Base64 string to an image.

Avoid screen blocking:

"SmartDevicesPlusUtil" provides the methods "TurnOffSleepMode" and "TurnOnSleepMode" that can be used to turn on or off the phone's "sleep mode" to prevent screen blocking.

This functionality is currently only available in Android.



Change screen brightness:

"SmartDevicesPlusUtil" provides the methods "SetScreenBrightness" and "GetScreenBrightness" that can be used to change the phone's screen brightness.

This functionality is currently only available in Android.

For example, if you want to change the screen brightness to the max value and then change it back in another moment, you only need to do the following:


Disable screenshots:

"SmartDevicesPlusUtil" provides the methods "TurnOnScreenRecording" and "TurnOffScreenRecording" that can be used to disable application screenshots.

This functionality is currently only available in Android.

To use this functionality, you must invoke these methods at the time you need:


This could be useful in screen in which you handle sensitive data:

Detecting phone's shake:

"SmartDevicesPlusUtil" provides an event that can be used to detect when the user "shakes" the phone. This can be used to execute any action, for example, change current page, play a sound, delete current record, etc.

This functionality is currently only available in Android.


If you are working in Android and you want to use it, first you need to turn on the shake listener with the method "TurnOnShake":


Then, you need to implement the code which will be executed in the event "OnShake":


In this example, we are just counting how many times the user has shaked the device.

Finally, when you want to finish listening you need to use the method "TurnOffShake":



Converts a size from dips to pixels, considering current device screen density.


Converts a size from pixel to dips, considering current device screen density.


Returns current device screen width in pixels.


Returns current device screen height in pixels.