Device inactivity script

I've noticed that you can run scripts with the device inactivity option.  I'm able to show a message to the device, but is it possible when they press a certain button there will be a action afterwards. I would like to close an app when pressing OK.. Could someone help me out?

for example

showmessagebox "error message"  NO_TIMER 4
if %ShowMessageBoxReturn% == IDOK goto KillBrowser command (kill_application com.honeywell.enterprisebrowser)
if %ShowMessageBoxReturn% == IDCANCEL goto Exit

9 months ago
Android Scripting
ANSWERS
RS
Rafael Schäfer
9 months ago

You could do this with Javascript BUT that's not supported by this functionality (yet).

ZC
Zafer Cigdem
9 months ago

Hi Pieter,

Just to give you some insight you may use something similar below as a JS for this:


var dialog_box_elements = ['Yes, install', 'Postpone to later'];
mobicontrol.message.createInfoDialog('Would you like to install new OS patch on your device?')
    .withButtons(dialog_box_elements[0], dialog_box_elements[1]).withCallback(onConfirm).show();
 
 
function onConfirm(result) {
    if (result.buttonIndex != null) {
        switch (dialog_box_elements[result.buttonIndex]) {
            case 'Yes, install':
mobicontrol.log.info('Yes case here...');
                break;
 
            case 'Postpone to later':
mobicontrol.log.info('Postpone case here...');
 
                break;
        }
    }
}
 

Example output:

You can check supported JS libraies and action from here: Home | Android Agent JavaScript

such as mobicontrol.app.stop('com.example');

I hope this helps. 

Zafer

P
PMMOD@SOTI
8 months ago

Hi Pieter Hoogerdijk,

Thank you for your post on SOTI Pulse. Apologies for the delayed response.

I understand that you want to execute a JavaScript based on device inactivity. To achieve this, please follow these steps:

  1. Click on the "+" icon to add a script configuration.
  2. Select an existing script or click on "Manage Script" to add a new one.
  3. Provide the required JavaScript and ensure that the script format is set to JAVA before saving.
  4. Deploy the script to the devices.

If you encounter any issues during this process, you may need to reach out to the support team for further assistance.

I would like you to create a support case (click here) or call the SOTI Support team (click here)  to gain a better understanding of the issue. We can then determine whether to raise a Feature Request or troubleshoot to fix the issue.

Please let us know so we can proceed further accordingly.