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

Solved
HV
Henk, van Asselt
Reverse IT ( Retail Trading Business B.V.)

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:

  1. What is the relationship between removing a WLAN network and Location Services?
  2. 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

a year ago
Android Scripting
ANSWERS
ZC
Zafer Cigdem
a year ago

Hi Henk,

if your main goal is kind of not letting the devices to connect this SSID anymore automatically, then you may also test whether WiFi JS to ovewrite same WiFi SSID information by using a wrong password or such.

AFAIK, it's only available Agent version 15.4.0+

example:

var wifiConfig = mobicontrol.wifi.createWifiConfiguration(wifiConfigString.ssid).withWpaSecurity(wifiConfigString.password);

mobicontrol.wifi.install(wifiConfig);

Solution
HV

Thanks Zafer,

When this is followed by a 'mobicontrol.device.reboot();' this works for me on both Zebra and Honeywell devices. So I marked post as being solved. 

But can you agree with me that the original observations, i.e. the inability of using 'mobicontrol.wifi.uninstall();' and the functionality of featurecontrol when using 'Location Accuracy: High Accuracy' can be seen as bugs?

Regards,
Henk

ZC
Zafer Cigdem
a year ago

Hi Henk,

Happy to hear that it helped. I don't know how it works at the backend side for the un-installation script (I did not need this one earlier), but I'm surprised that it's required high accuracy settings. 

You may create a SOTI Support ticket and get more information or request help for uninstall JS script as well. 

Have a great week :)

Zafer

This is related but i currently don't know get all together but i think this was something Android related dependency.

You should be able to turn it on via Feature Control profile or OEM config (or both).

HV

Hi Rafael,

Thank you for your response, however, both options do not work to get this problem solved.

Indeed, Zebra's OEMConfig can turn on the generic 'Use Location' setting, but the sub-setting 'Google Location Accuracy' stays off...

Using a profile with Feature control -> Location Accuracy: High Accuracy does also turn on the generic 'Use Location' setting, and Wi-Fi scanning:On and Bluetooth scanning:On, but 'Google Location Accuracy' stays Off, and is now even blocked (grayed out).

ST
Shawn T
a year ago

Hi Henk,

Since you are using Zebra devices, why not use the MX toolset and disable the staging WLAN via MXXML. 

<wap-provisioningdoc>
  <characteristic version="8.1" type="Wi-Fi">
    <parm name="UseRegulatory" value="0" />
    <parm name="UseDiagnosticOptions" value="0" />
    <parm name="UseAdvancedOptions" value="0" />
    <parm name="NetworkAction" value="Disable" />
    <characteristic type="network-profile">
      <parm name="SSID" value="yourssid" />
    </characteristic>
    <parm name="UseHotspotOptions" value="0" />
  </characteristic>
</wap-provisioningdoc>
 
HV

Thank you Shawn,

This would work, and there is a similar method for Honeywell devices with the Enterprise Provisioner..

However, I was hoping that the SOTI method would be the generic solution, independend of the manufacturer of the device.

Regards,
Henk

RK
Radim Kadlec
a year ago

I encounter a similar situation when I need to remove the SSID used for device enrollment. I handle this by creating a MobiControl Wi-Fi profile utilizing the same SSID as the one used for enrollment. I apply this profile to only one (enrollment) device group. When I move the device to another device group, the profile is no longer applied, so it is removed = the enrollment SSID is gone.

HV

I agree, this is a good method as well.

//Henk

S
SKMOD@SOTI
a year ago

Hi Henk van Asselt,

 

I wanted to extend my gratitude for your post on SOTI Pulse. I also want to express my thanks to Rafael, Shawn, Radim, and Zafer for their valuable contributions and willingness to assist.

 

I trust that Zafer's solution has proven helpful in resolving the issue you encountered. 

 

Should you have any further questions or concerns, please feel free to reach out. We're dedicated to providing assistance and support.

 

 

Kind regards,

Technical Support | SOTI Inc. |1.905.624.9828 | support@soti.net | www.soti.net |

HV

Yes, thank you.

The answer of Zafer did provide a workaround.
Unfortunately, the original problem, i.e. mobicontrol.wifi.uninstall() fails to to the job, that remains unsolved.

Regards,
Henk

HV
Henk, van Asselt
8 months ago

As a followup, I would like to report that MobiControl Agent version 2025.0.4.1100 does work for me now.
1. In Settings -> Location -> Location services, Location Accuracy is “On”
2. mobicontrol.wifi.uninstall() will work now without complaining.

Regards,
Henk