Script to change values within //settings/global?

GG
Gerald Gilmore
Canadian Tire

I came across a previous conversation regarding the 'watchsettings on' script within MobiControl, however I have a question on how to send a script to an Android 6.0.1 device where the setting is defined as 'global'.

Does anyone know the correct format for changing values within the //settings/global range, for example Bluetooth or WIFI?

Bluetooth Off
Custom log (URI:content://settings/global SETTING:bluetooth_on VALUE:0

Bluetooth On
Custom log (URI:content://settings/global SETTING:bluetooth_on VALUE:1

7 years ago
Android
ANSWERS
MD
Matt Dermody Diamond Contributor
7 years ago

I haven't tested this but these are the formats that I would expect:

Bluetooth off

writesecuresetting -glo bluetooth_on 0

 

Bluetooth On

writesecuresetting -glo bluetooth_on 1

GG
Gerald Gilmore
7 years ago

I tried both of those on one of our tablets and that didn't work.

As recently as today, I tried to change the OS language on a Zebra MC40 (OS 4.4.4) from English to French and vice versa and still could not get the language to change. This is what I got from the 'watchsettings on' logs.

Change to English
Custom log (URI:content://settings/secure SETTING:input_methods_subtype_history VALUE:com.android.inputmethod.latin/.LatinIME;-354699631)

Change to French
Custom log (URI:content://settings/secure SETTING:input_methods_subtype_history VALUE:com.android.inputmethod.latin/.LatinIME;-921088104)

My understanding is that the script below would force the OS language to English?

writesecuresetting -sec input_methods_subtype_history com.android.inputmethod.latin/.LatinIME;-354699631

Or am I missing something here......any ideas

TB
TJ Bukoski
7 years ago (edited 7 years ago)

Hi Gerald,

writesecuresetting works by modifying the settings table in the Android OS's settings database with the WRITE_SETTINGS Android permission. Some settings require more than just changing a database value in the OS to work and require a call to an Android API. In some cases (where we have access to said API) we built separate script commands to accomplish this:

setradioenable <wifi/bt/phone> <1/0>

To disable Bluetooth radio:

setradioenable bt 0

To enable Bluetooth radio:

setradioenable bt 1

setlocale <locale>

To set locale to English Canadian:

setlocale en_CA

Hope that helps, the script examples were pulled from the v13 help file here:

v13 Help File: Script Command Set