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 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
  • 0 votes 1 answer

    Bluetooth Discoverable

    Hello, how can i set Blooetooth permission that the device is discoverable via Script. ? android.permission.BLUETOOTH_ADVERTISE

    Android Scripting
    2 years ago
  • 0 votes 4 answers

    Enabling Developer Options and disabling wifi scan throttling via script

    I am trying to find a way to: 1) Enable Developer Options/Mode 2) Disable Wifi Scan Throttling with android scripting but not having any luck. One of the locations I manage, seems to be having issues with wifi dropping but only with the Samsung Tab A8.  The android phones we have on the same network do not have the issue.  One of the onsite techs disabled wifi scan throttling and it seems to have had a positive result.  If I can avoid having them touch every device to change this and instead can push it out with soti it would help a lot

    Android Scripting
    2 years ago
  • 0 votes 10 answers

    Getting a device's IP address with the Javascript API Solved

    Is there any way to get a device's IP address using SOTI's Javascript API? When I call the below function from within the API, I get back "undefined", but getting the same info using the %HOSTNAME% macro using legacy scripting returns an IP, is there anything I'm doing wrong here? var ip = mobicontrol.network.IpAddress.hostName; mobicontrol.log.info(""+ip); The log was just to test what value gets returned from the variable above.

    Android Scripting
    2 years ago
  • 0 votes 5 answers

    Install package with legacy script from a JavaScript script package

    Hello everyone, I'm attempting to install a .pcg package from JavaScript, but it's not working, and I'm running out of ideas on what else to try. A main JavaScript script is being executed, and it should install a .pcg package with a legacy sendintent script. While it works perfectly when executed from the MobiControl console on the device, encapsulating the script in a package/profile doesn't work. The sendintent from the legacy script never executes. I've come across this post which seems to have a similar issue but no promising solution. I based my approach on a post by Raymond Chan that provided instructions for achieving something similar, which I can't find now. He suggested creating packages to be called from other packages with a PRE-script and copying them using a file sync rule. Perhaps I misunderstood, but here's what I did: Created a package with a legacy PRE-Script containing the sendintent command. Copied the script to the device in an initial configuration package containing various device configuration files. This package is installed several steps before the JavaScript script is executed, so the .pcg package is in its location before being called by the script. I didn't use file sync as Ray suggested; instead, I copied it through another package. I'm not sure if this could be part of the problem. The JavaScript script is executed in a package, and I've tried copying the JS code both in PRE-script and POST-script, but in both cases, I have the same problem. The JavaScript code runs correctly, but the intent is never triggered. I've also tried setting a pause immediately after the mobicontrol.packages.install statement using the setTimeout(onExit, 30000) method in case the issue is that the execution of the main script ends before the second legacy script is installed, but I still haven't managed to get it to work. I believe the code is correct because, as mentioned earlier, if I run the code from the scripts section of the web console, it works perfectly. Am I doing something wrong? Is it possible to achieve what I'm trying to do? Best regards.

    Android Scripting
    2 years ago
  • 0 votes 13 answers

    Zebra TC52 scheduled reboot

    Hello :) I have about 200 Zebra TC52 terminals that I have to restart every morning. I have a constraint that prevents me from using a "simple" scheduled task, I have to reboot the terminals over a range of one hour, so that they don't all reboot at the same time. So I've set up a scheduled task that calls a JavaScript script: function alea(min, max) {     return Math.floor(Math.random() * (max - min + 1)) + min; } var entier = alea(60000, 3600000); var info = Math.round(entier / 60000);   mobicontrol.message.createInfoDialog('redémarrage dans ' + info + ' minutes').show(); setTimeout(mobicontrol.device.reboot, entier); Generally speaking, this script works and the terminals restart randomly between 08:00am and 09:00am. But for some reason, some terminals restart later... And sometimes up to several hours later! And yet, they're online, the SOTI agent is up and running, and when I look at the log I see that the task was launched at 08:00am with an execution time of several hours... What could be causing this? I'm looking for a solution because restarting a terminal outside this range is a problem... Thanks in advance!

    Android Scripting
    2 years ago
  • 0 votes 6 answers

    I need a script to disable "Lift to Wake" option on my Samsung devices

    I need a script to disable "Lift to Wake" option on my Samsung devices: Users are complaining about this feature and we have enabled already for at least 1000 devices.

    Android Scripting
    2 years ago
  • 0 votes 6 answers

    Is it possible to execute JavaScript-Scripts with MC Packages? Solved

    Hey Guys, we're using a lot of legacy Scripts in our Packages without any issue. Now we have a Demand to execute a JavaScript-Script inside a Package but I won't get this thing running.The Script works fine when I use "Send Script" but we want to deploy it as a Package (so also Filesync and / or Task Scheduler is actually not an option for us). Is there any chance to get this running? Or it is actually not supported to use JS with MC-Studio? Kind regards

    Android Scripting
    2 years ago
  • 0 votes 5 answers

    My Samsung devices are reporting inaccurate device time, cannot set the Time Zone as devices are physically moving across time zones regularly (e.g. devices in vehicle).

    Devices are being kitted for a new deployment and are powered down and shelved after kitting is complete. When the devices are coming on line some of them are showing inaccurate time reported in the logs. Is there a way to automate the time zone settings to enable these 2 settings as we already have a number of devices that have been completed.

    Android Scripting
    2 years ago
  • 0 votes 2 answers

    Script to enable / disable dark mode on Android

    We have Samsung tablets and can't figure out if there is a writesecuresetting script or something to enable / disable dark mode. Has anyone figured out how to do this?

    Android Scripting
    2 years ago
  • 0 votes 8 answers

    Automating Set Timezone based on Location setting

    I have fleet of samsung devices that are on the wrong time zone, I cannot use soti's time sync option as these devices are across different time zones. All my woes would be solved if this script would work but as the last line is attempting to edit a secure setting and not a global setting it is getting a permissions error. (Set timezone based on location is off by default on multiple devices)  writesecuresetting -glo auto_time 1writesecuresetting -glo auto_time_zone 1writesecuresetting -sec location_time_zone_detection_enabled 1 The error from the ADB logs is below  script-executor|E|DO|[net.soti.mobicontrol.script.s0.n:37] Failed to exec script command: writesecuresetting [-sec, location_time_zone_detection_enabled, 1]|java.lang.SecurityException: Permission denial: Device owners cannot update location_time_zone_detection_enabled Anyone have any ideas on automating this a different way?

    Android Scripting
    2 years ago
  • 0 votes 5 answers

    Upgrade Android 10 for Zebra TC26 to Android 11 in Mobicontrol Solved

    Hi,  Upgrade by Soti doesn't work for us as specified by Zebra (link: Perform an OS Update Using StageNow Tool or SOTI MobiControl (zebra.com)) Upgrade is working fine by StageNow by two copy file operations (full.zip and payload.upl) + plus running the payload file. Then I tried a new sync rule with those two files and running the script but upgrade doesn't get initialised.  No error message, only: Script was sent to device (sendintent -b "intent:#Intent;action=com.motorolasolutions.intent.action.UPDATE_PACKAGE;S.file=/sdcard/payload.upl;end") Do you know someone a solution? Best regards,

    Android Scripting
    2 years ago
  • 0 votes 5 answers

    Trigger Package from MobiControl JavaScript is not working within package

    Hello, I have a solution that consists of three steps, split between two packages: Package 1:1. (Pre-install, Legacy) Download a .txt file from ftp.2. (Post-install, JavaScript) Process file and identify specific row, to be used for package 2. (Verifies each row with build number and modifies a provision.xml based on it) Package 2:1. (Post-Install, Legacy), performing an intent, invoking the provision.xml based on result from Package 1. The problem is that if I send all these three steps manually via "Send Script" on a device, it works flawlessly. But when I have built it as packages in MobiControl Package Studio, everything works except the command: "mobicontrol.packages.install('/sdcard/Download/package.pcg')" It does not give any error or anything.And that is only when it is built in a package. Do anyone have any ideas on how to resolve this? Can anyone replicate the issue?Have a package with a JavaScript post-install that starts another .pcg file. Info on the device I have tested on; MobiControl Version: 2024.0.0.1074 Agent på enheten: 2024.0.0.1005 Thanks in advance

    Android Scripting
    2 years ago
  • 0 votes 4 answers

    Android Intent - Settings Manager open to specific screen activity Solved

    Hi, We are playing with the Settings Manager for a specific scenario and want to launch the application to a specific screen within the app launched from lockdown kiosk screen.  I'm not overly familiar with Android intents so not sure if this possible or not from intent or a launch script.  I've tried a bunch of different variations but can't seem to get it to work. From the identify_activity script, I found the specific activity to be:  net.soti.settingsmanager/.wifi.WifiNetworkSavedActivity Does anyone know if an intent (or launch script) could be formulated to launch the Settings Manager app directly into that screen?

    Android Scripting
    2 years ago
  • 0 votes 2 answers

    appops

    Hi, Is there a way to implement this? # All Android versions pm grant de.proglove.connect android.permission.ACCESS_FINE_LOCATION pm grant de.proglove.connect android.permission.CAMERA appops set de.proglove.connect GET_USAGE_STATS allow # For Android 10 and above pm grant de.proglove.connect android.permission.ACTIVITY_RECOGNITION pm grant de.proglove.connect android.permission.ACCESS_BACKGROUND_LOCATION appops set de.proglove.connect SYSTEM_ALERT_WINDOW allow # For Android 12 and above pm grant de.proglove.connect android.permission.BLUETOOTH_SCAN pm grant de.proglove.connect android.permission.BLUETOOTH_CONNECT pm grant de.proglove.connect android.permission.BLUETOOTH_ADVERTISE # For Android 13 and above pm grant de.proglove.connect android.permission.POST_NOTIFICATIONSRequired permissions (proglove.com)

    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.