Unable to use javascript to deactivate "device admin apps"

Solved

Hello Community,

We currently have a third party apps installed, which is enabled as "device admin app".

In the SOTI JS documentation, there is an explanation and simple example script to deactive this admin app.

https://www.soti.net/mc/help/javascriptapi/en/mobicontrol.app.html#.deactivateAdmin

mobicontrol.app.deactivateAdmin('com.example');

Unfortunately, I get an error "Custom log (AdminDeactivationError: App deactivation not supported. (UserScript#1))"

Device: Datalogic Memor20 on Android 9
Agent Version: 2025.1.2.1214
MobiControl Version: 2024.1.1.1058

Do you guys have any clue why this script is not working? Do I need to upgrade to a later version of Android to get it work?

Many Thanks, Raphael. 

4 months ago
Android Scripting
ANSWERS
R
Raphael
4 months ago

Hi Guys, thanks for your answer on this topic. Yes our devices are enrolled as Work Managed devices.

I've tested the same device (Memor20) on Android 11 & Android 13 and for these OS the script is working.

It seems the script is not supported for A9 which is very unfortunate for me and my case.

For interest, I tried the script on a Zebra PS20J with A9 and A11 aswell. I got the same message, "Custom log (AdminDeactivationError: App deactivation not supported. (UserScript#1))" Is this expected behavior, because you always can configure such apps with a StageNow profile and deploy it to the device. (Didn't test it, but should work theoretically).

Zebra devices are also enrolled as WorkManaged devices and tested on latest agentversion 2025.1.2.1214 - Here I'm just curios.

Solution
E
ENMod
3 months ago

Hey Raphael,

Thank you for your response and testing it out. I would recommend you to log a case with us so we can further investigate the issue more effectively and help you reach a conclusion on your queries. Cheers, have a wonderful day ahead.

Technical Support, SOTI | Call Us | SOTI.net | Discussion Forum | Log a Case Online

RS
Rafael Schäfer
4 months ago

Maybe this is not supported on Android 9 or this device.
You should meet the requirements (agent version minimum 2024.1.0) for this script so i guess this must be something on OS side.

You should reach out to support as it's not mentioned anywhere if there are other dependencies.

E
ENMod
4 months ago

Hey Raphael,

Thanks for posting on SOTI Pulse. Thanks Rafael Schäfer for your assistance. Can you please let me know if the device has been enrolled as Work Managed or is it enrolled using the Classic Enrollment method? Thank you!!

Technical Support, SOTI | Call Us | SOTI.net | Discussion Forum | Log a Case Online

RC
Raymond Chan Diamond Contributor
4 months ago

Raphael,

There can be more than one MDM API call to do similar thing, and each call may have different pre-requistes (e.g. device agent version, Android firmware version, enrollment mode, and other customization(s) specific to the firmware implementation of a particular device model).  So, actually testing a particular legacy or javascript command on specific device model of specific version is usually needed to confirm if it works or not.    Unless there is clear document from hardware vendor or Soti that the particular configuration (e.g. device of certain brand/model running a specific firmware version) works and test results show otherwise, there is usually nothing one can do except to report it or make feature request to relevant party.   Hence, for many of my customers in the last 10+ years, I always advised them to test out compatibility of CRITICALLY needly features (such as mandatory script command needed) on test device before making bulk purchase of such device model for their targeted corporate use-case.