Community - SOTI MobiControl

Community - SOTI MobiControl

There's a new home for Articles. Find Articles on Our Product Support Page.

Android Scripting Discussions


  • 0 votes 6 answers

    How to clear the cache of zebra devices for apps I have installed Solved Locked

    Hello there, I'm in need of clearing the cache of two apps that I've installed on my zebra devices, there seems to be a few ways to achieve this but I'm not sure which is the best for me. I want to clear the cache of two specific apps I've installed weekly. Any help is much appreciated.

    Android Scripting
    5 months ago
  • 2 votes 5 answers

    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 9Agent Version: 2025.1.2.1214MobiControl 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. 

    Android Scripting
    10 months ago
  • 0 votes 8 answers

    Using writesecuresetting in Android Javascript script to update Private DNS Solved

    I've successfully used writesecuresetting in a legacy script to update the private_dns_mode and private_dns_specifier of phones running Android 13 and Android 14. Here's a working example: writesecuresetting -glo private_dns_mode hostnamewritesecuresetting -glo private_dns_specifier profilename.dns.nextdns.io However, I want to write a script that periodically checks to ensure that setting is still set, and corrects it if the user changes it. Also, I want to change the DNS specifier string based on the phone name and various other settings. I'm comfortable writing the necessary javascript logic, but I can't find a way to run writesecuresetting to change the setting. This seems like a significant oversight (either in the API design or on my part), and adding this would open all sorts of scripting possibilities. This may be an XY problem, so feel free to point me to a better way to do this. Edit: Just realizing this would be entirely possible if there was an API to run shell commands. That would open up all sorts of opportunities for more powerful scripting.

    Android Scripting
    a year ago
  • 0 votes 5 answers

    Android+ Remote Device Shutdown Solved

    Hello, Using Mobicontrol version 2025.0.1.1164 and my device is Zebra Tc27 Android 13. Looking for a script to turn off the devices remotely.

    Android Scripting
    a year ago
  • 0 votes 3 answers

    Navigation bar script Solved

    Hello, I had a question, I can't find anything about this in the "help" folder directly and after searching for a bit, i gave up.  If you have an samsung xcover 6 or + you have the 3 buttons (navigation bar) down below. In the config on the samsung itself you can change this manually to go the other direction. Is there any chance this can be made into a script so I can put this script on my config file for other phones aswell?

    Android Scripting
    a year ago
  • 0 votes 6 answers

    How do I execute my XML file in JavaScript? It shows the right file to process however it is not processing the file. I think i'm missing a piece Solved

    Here is my code and the output, it shows the right file to execute but it is not processing the file. /* global mobicontrol */var ip = null;mobicontrol.network.activeNetwork.ipAddresses.forEach(ipInner => {    if (!ipInner.isLoopback && !ipInner.isLinkLocalAddress) {        var currentIp = ipInner.hostAddress;        const re = /^\d+\.\d+\.\d+.\d+$/;        var isIp4 = re.test(currentIp);        if (isIp4) {            ip = currentIp;            return;        }    }});var filename;if (ip !== null) {    var split_it = ip.split(".");    var octet2 = ip[1];    var serverNumber = parseInt(octet2, 10);    switch (serverNumber) {        // each needs to represent the service center number and associated timezone        case 65: //ABI        case 64: //AMA        case 55: //AUS        case 26: //BHM        case 87: //BLG        case 47: //BTR        case 60: //CRP        case 41: //DFW        case 31: //DOT        case 69: //FTS        case 80: //FTW        case 90: //GAR        case 42: //HOU        case 28: //HSV        case 35: //JAC        case 79: //JBO        case 56: //JCK        case 78: //LAF        case 61: //LRD        case 70: //LRK        case 88: //LUB        case 59: //MCA        case 29: //MGM            filename = '/sdcard/TimeZones/Central_TimeZone.xml';        case 63: //ELP            filename = '/sdcard/TimeZones/Mountain_TimeZone.xml';        case 49: //RCO            filename = '/sdcard/TimeZones/Atlantic_TimeZone.xml';                    default:            filename = '/sdcard/TimeZones/Eastern_TimeZone.xml';    }} else {    mobicontrol.log.error("Could not find the machine's IP Address defaulting to Eastern.");    filename = '/sdcard/TimeZones/Eastern_TimeZone.xml';}mobicontrol.log.info('Found ' + filename + ' to sync.');// Map the timezone to some configuration file to be downloaded.//The time zone files will be synced prior to implementing this via soti file sync rule

    Android Scripting
    a year ago
  • 0 votes 6 answers

    Display Full Notification Details on Lock Screen Solved

    Hello everyone,I’m looking for a script to change the notification display on the lock screen. Currently, only icons are shown, but I would like all details to be displayed. Is there a script for this? The manual procedure is attached. Device: Samsung Galaxy XCover 5 Thank you!

    Android Scripting
    a year ago
  • 0 votes 2 answers

    How do I write the Device ID and Mac Address to an XML file on the SD Card? Is that possible? Solved

    How do I write the Device ID and Mac Address to an XML file on the SD Card? Is that possible?  Here is what I have so far from, but i'm not sure how to get this in a XML file on the device: function getDeviceId() { return mobicontrol.device.id; } var deviceId = getDeviceId(); mobicontrol.log.info("Device ID: " + deviceId);

    Android Scripting
    a year ago
  • 0 votes 11 answers

    JS to process a synced file based on the custom attribute Solved

    New to JS but I want to sync a certain time zone xml file based on the location of a device, where i will get the location from the custom attribute. is this possible? I found this on SOTI portal but not sure how to use it with processing the time zone file that I've synced, instead of just displaying it in the logs. SEFL_LOC is my custom attribute: var myCustomValue = mobicontrol.agent.getCustomAttribute("SEFL_LOC"); if (myCustomValue != null) {     mobicontrol.log.info("Custom attribute for key SEFL_LOC: " + myCustomValue); } else {     mobicontrol.log.info("Custom attribute for key SEFL_LOC is not found"); } sdcard/Timezones is the path 

    Android Scripting
    a year ago
  • 0 votes 3 answers

    SendIntent to Zebra Datawedge to delete profile Solved

    Hi, I am running MobiControl (still on 15.6) and I need to delete a profile in the Zebra Datawedge. Before I can install the new version of an application I need to make sure that the old profile is deleted from the device. The Datawedge profile was created by the app but the app is developed not very good, so I need to take care of it.  I thought I could do it with a script (sendintent) but somehow nothing is happening. Here is what I tried to send to the device: sendintent -b "intent:#Intent;action=com.symbol.datawedge.api.ACTION;S.putExtra=DELETE_PROFILE,xxxProfileNamexxx;end"   The techdocs of Zebra Delete Profile - Zebra Technologies TechDocs are not very useful to me so maybe one of you can send me to the right direction or give me some hints.   Thanks in advance  

    Android Scripting
    a year ago
  • 0 votes 3 answers

    Script to process XML file that is already synced to device for Honeywell devices: MXconfig is not working for this brand Solved

    I am trying to process an XML script that will install the wifi and configure the frequency band for 5ghz. I have been able to do this successfully scanning the barcode but our devices are in the field so i am trying to do it programmatically. I exported the barcode config and saved it as a xml and synced it to the device but I am unsure of the command that will execute it. Mxconfig is what i normally use for the zebra devices but i am getting the error that command is not supported for my honeywell  devices.  What command do i need to execute this script?

    Android Scripting
    a year ago
  • 0 votes 2 answers

    Sendintent via Javascript Solved

    Hello community, I have to implement a package script for Android devices which have to use a sendintent in relation to the OS version  of the calling device (>10 yes, otherwise not). The legacy scripting is really limited in logical branching. So I decide to use Javascript for implementation. So my question, is there a way to send an intent from Javascript on the device or to trigger a sendintent from there?  Thanks for any comment! Kind regards     Kersten

    Android Scripting
    a year ago
  • 0 votes 5 answers

    Deleting files older than 90 days Solved

    Good day, I need assistance with a task. I want to delete files that are for example, older than 90 days. Using a "del" script, I can delete the files, but how do I specify that only files older than 90 days should be deleted? Do you have any ideas? Thank you MobiControl v2024.1.0 Android Enterprise Managed

    Android Scripting
    a year ago
  • 0 votes 12 answers

    Cannot remove a WiFi network with javascript mobicontrol.wifi.uninstall() Solved

    Hi all,Using MobiControl 2024.0.1 and a Zebra TC26 with Android 13 with agent version 2024.1.2.1105, I am trying to remove an WLAN network with Javascript, like the following example.The reason for this removal is that this is the staging network, and the device should not stick to it... var accessPoint = mobicontrol.wifi.listAccessPoints().find(ap => ap.ssid == "My_SSID");mobicontrol.wifi.uninstall(accessPoint);mobicontrol.log.info("My_SSID is removed."); This does not work, the MobiControl log shows: Custom log (WifiError: Location services are off. (UserScript#1)) My questions are: What is the relationship between removing a WLAN network and Location Services? The script works if I manually go on the device to Settings -> Location -> Advanced and enable 'Google location accuracy'.  Can this setting be enabled with SOTI MobiControl, so the removal of a WLAN network will be successfull? Thanks,Henk

    Android Scripting
    2 years ago
  • 0 votes 5 answers

    Clear cache on applications Solved

    So currently I have a clear cache script that i deploy to our devices via a profile and it puts clearcache.scr file in the root of the device and i have an icon on the lock screen to call this script and it will clear cache on the selected applications. What I am trying to figure out is there a way i can have a prompt in this script that if they answer yes it runs and if they answer no it will just exit?  The current contents of the clearcache.scr file is below: wipeapplication com.overvyoo.clientsleep 1wipeapplication com.darsleep 1wipeapplication net.soti.surfsleep 1wipeapplication com.android.chromesleep 1

    Android Scripting
    2 years ago

Top 3 Contributors of The Week

View All

Earn Contributor Badge

More info
  • Diamond
    Diamond New

    Top-tier experts who are delivering outstanding content. Should have more than 7000 points.

  • Platinum
    Platinum

    Experts who are consistent with great content. Should have more than 1000 points.

  • Gold
    Gold

    Highly experienced members with valuable inputs. Should have more than 700 points.

  • Silver
    Silver

    Beginners taking the initiative. Should have more than 500 points.

  • Bronze
    Bronze New

    New contributors starting their journey. Should have more than 250 points.