Since: API level 17
public class

SettingsManager

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.custom.SettingsManager

Class Overview

This class provides APIs to allow secure system settings to be changed.
The API will return ERROR_FAIL, if the API fails for an unknown reason or because the service was not available.

NOTE: Since version 2.5, the architecture of the SDK changed.
Now, all APIs are members of different classes according to their permission type. (APIs with permission type KNOX_CUSTOM_PROKIOSK, KNOX_CUSTOM_SETTING & KNOX_CUSTOM_SYSTEM are placed in ProKioskManager, SettingsManager & SystemManager classes respectively).
Additionally, a main interface class has been created, CustomDeviceManager, which allows public access to the above classes and provides some utility APIs.

Since
API level 17
Version 2.5

Summary

Public Methods
boolean getAirGestureOptionState(int mode)
This method gets the Air Command or Air View state.
boolean getBackupRestoreState(int type)
Deprecated in API level 27
boolean getChargingLEDState()
Deprecated in API level 27
int getEthernetConfigurationType()
This method gets the type of Ethernet configuration.
boolean getEthernetState()
This method gets the state of Ethernet.
boolean getLTESettingState()
Deprecated in API level 27
boolean getMotionControlState(int type)
This method gets the selected motion control state.
boolean getPackageVerifierState()
This method gets the state of the Google package verifier.
int getPowerSavingMode()
This method gets the current power saving mode.
boolean getProtectBatteryState()
This method gets the Protect battery state.
boolean getScreenWakeupOnPowerState()
This method gets the state of whether screen is turned on when power is connected to device.
int getSettingsHiddenState()
This method gets the currently HIDDEN UI elements in the Settings app on the device.
boolean getWifiConnectionMonitorState()
This method gets the state of the Wi-Fi connection monitor.
int getWifiFrequencyBand()
Deprecated in API level 27
int setAdbState(boolean state)
This method turns on/off USB debugging, allowing ADB connection to the device.
int setAirGestureOptionState(int mode, boolean state)
This method turns on/off the air gesture functionality.
int setBackupRestoreState(int type, boolean state)
Deprecated in API level 27
int setBluetoothState(boolean state)
This method turns Bluetooth on or off.
int setBrightness(int level)
This method sets the screen brightness level.
int setChargingLEDState(boolean state)
Deprecated in API level 27
int setDeveloperOptionsHidden()
This method hides the Developer options menu item in the Settings menu if it is turned on by the user by clicking multiple times on Build number in Settings menu.
int setEthernetConfiguration(int connectionType, String staticIpAddress, String staticNetmask, String staticDnsAddress, String staticDefaultRouter)
This method sets up the Ethernet configuration to either use DHCP or Static IP.
int setEthernetState(boolean state)
This will allow the device to use Ethernet networking via USB.
int setFlightModeState(int state)
This method turns flight mode on and off.
int setGpsState(boolean state)
Deprecated in API level 27
int setInputMethod(String inputMethodClassName, boolean force)
This method sets the input method to the specified class.
int setLTESettingState(boolean state)
Deprecated in API level 27
int setMobileDataRoamingState(boolean state)
This method turns on/off mobile data roaming.
int setMobileDataState(boolean state)
This method turns mobile data on or off.
int setMotionControlState(int type, boolean state)
This method turns on/off the selected motion control.
int setPackageVerifierState(boolean state)
This method turns on/off the Google package verifier.
int setPowerSavingMode(int mode)
This method turns on/off the power saving option of the device.
int setProtectBatteryState(boolean state)
This method turns on/off the "Protect battery" menu option in Settings.
int setScreenWakeupOnPowerState(boolean state)
This method turns on/off whether screen is turned on when power is connected to device.
int setSettingsHiddenState(boolean state, int elements)
This method hides or shows UI elements in the Settings app on the device.
int setStayAwakeState(boolean state)
This method turns on/off Stay Awake (screen always on when plugged in).
int setSystemLocale(String localeLanguage, String localeCountry)
This method sets the default language and region for the device.
int setUsbDeviceDefaultPackage(UsbDevice usbDevice, String applicationPackage, int applicationUid)
This method sets the default application that is to be notified when a USB device is connected.
int setWifiConnectionMonitorState(boolean state)
This method turns on/off the Wi-Fi connection monitor.
int setWifiFrequencyBand(int band)
Deprecated in API level 27
int setWifiState(boolean state, String ssid, String username, String password)
This method turns Wi-Fi on or off; and optionally configures a connection to an access point.
int setWifiState(boolean state, String ssid, String password)
This method turns Wi-Fi on or off; and optionally configures a connection to an access point.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean getAirGestureOptionState (int mode)

Since: API level 17

This method gets the Air Command or Air View state.

Parameters
mode Gesture mode - GESTURE_AIR_COMMAND / GESTURE_AIR_VIEW.
Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getAirGestureOptionState(CustomDeviceManager.GESTURE_AIR_COMMAND)) {
     Log.d(TAG, "Air Command is on");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public boolean getBackupRestoreState (int type)

Since: API level 17

Deprecated in API level 27

This method gets the state of backup and restore.

Parameters
type the type: BACKUP or RESTORE.
Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getBackupRestoreState(CustomDeviceManager.BACKUP)) {
     Log.d(TAG, "Backup is on");
 }
 
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public boolean getChargingLEDState ()

Since: API level 17

Deprecated in API level 27

This method gets the state of the Charging LED.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getChargingLEDState()) {
    Log.d(TAG, "Charging LED is on");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int getEthernetConfigurationType ()

Since: API level 17

This method gets the type of Ethernet configuration.

Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getEthernetConfigurationType() == CustomDeviceManager.ETHERNET_DHCP) {
     Log.d(TAG, "Ethernet is using DHCP configuration");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public boolean getEthernetState ()

Since: API level 17

This method gets the state of Ethernet.

Returns
  • true if ethernet is on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getEthernetState()) {
     Log.d(TAG, "Ethernet is on");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public boolean getLTESettingState ()

Since: API level 17

Deprecated in API level 27

This method gets the state of the "LTE Only" menu option in Settings.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getLTESettingState()) {
     Log.d(TAG, "LTE-only setting is on");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public boolean getMotionControlState (int type)

Since: API level 17

This method gets the selected motion control state.

Parameters
type the control type: MOTION or PALM_MOTION.
Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getMotionControlState(CustomDeviceManager.MOTION)) {
     Log.d(TAG, "General motion is on");
 }
 
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public boolean getPackageVerifierState ()

Since: API level 17

This method gets the state of the Google package verifier.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getPackageVerifierState()) {
     Log.d(TAG, "Google package verifier is on");
 }
 
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int getPowerSavingMode ()

Since: API level 17

This method gets the current power saving mode.

Returns
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getPowerSavingMode() == CustomDeviceManager.POWER_SAVING_ON) {
    Log.d(TAG, "Power saving is on");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public boolean getProtectBatteryState ()

Since: API level 29

This method gets the Protect battery state.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getProtectBatteryState() {
     Log.d(TAG, "Protect battery is on");
 }
 
Since
API level 29
Version 3.4
Multiuser Environment
Global Scope

public boolean getScreenWakeupOnPowerState ()

Since: API level 17

This method gets the state of whether screen is turned on when power is connected to device.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getScreenWakeupOnPowerState()) {
     Log.d(TAG, "Screen wakeup on power is on");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int getSettingsHiddenState ()

Since: API level 17

This method gets the currently HIDDEN UI elements in the Settings app on the device.

Returns
  • The hidden elements as a mask.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 int elements = kcsm.getSettingsHiddenState();
 Log.d("Wi-Fi setting: " + (((elements & CustomDeviceManager.SETTINGS_WIFI) != 0) ? "hidden" : "shown"));
 Log.d("Bluetooth setting: " + (((elements & CustomDeviceManager.SETTINGS_BLUETOOTH) != 0) ? "hidden" : "shown"));
 // etc.
 
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public boolean getWifiConnectionMonitorState ()

Since: API level 17

This method gets the state of the Wi-Fi connection monitor.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getWifiConnectionMonitorState()) {
     Log.d(TAG, "Wi-Fi connection monitor is on");
 }
 
Since
API level 17
Multiuser Environment
Global Scope

public int getWifiFrequencyBand ()

Since: API level 17

Deprecated in API level 27

This method gets the current Wi-Fi frequency band.

Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 SettingsManager kcsm = cdm.getSettingsManager();
 if (kcsm.getWifiFrequencyBand() == CustomDeviceManager.WIFI_FREQUENCY_BAND_AUTO) {
    Log.d(TAG, "Wi-Fi frequency band is Auto");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setAdbState (boolean state)

Since: API level 17

This method turns on/off USB debugging, allowing ADB connection to the device.

Parameters
state true to turn on ADB, false to turn it off .
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setAdbState(true);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setAirGestureOptionState (int mode, boolean state)

Since: API level 17

This method turns on/off the air gesture functionality.

Parameters
mode Gesture option to set - GESTURE_AIR_COMMAND / GESTURE_AIR_VIEW.
state true to turn on, false to turn off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setAirGestureOptionState(CustomDeviceManager.GESTURE_AIR_COMMAND, false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setBackupRestoreState (int type, boolean state)

Since: API level 17

Deprecated in API level 27

This method turns on/off backup and/or restore.

Parameters
type the type(s): BACKUP and/or RESTORE.
state true to turn on, false to turn off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setBackupRestoreState(CustomDeviceManager.BACKUP, true);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setBluetoothState (boolean state)

Since: API level 17

This method turns Bluetooth on or off.

Parameters
state true to turn Bluetooth on, false to turn it off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setBluetoothState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING", "android.permission.BLUETOOTH" and, "android.permission.BLUETOOTH_ADMIN" permissions.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setBrightness (int level)

Since: API level 22

This method sets the screen brightness level.

Parameters
level The screen brightness level as a value between 0 and 255, or USE_AUTO for auto brightness
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setBrightness(128);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 22
Version 2.8
Multiuser Environment
Global Scope

public int setChargingLEDState (boolean state)

Since: API level 17

Deprecated in API level 27

This method turns on/off the LED when the screen is off and the device is charging.

Parameters
state true to turn on Charging LED, false to turn it off .
Returns
  • SUCCESS The state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setChargingLEDState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setDeveloperOptionsHidden ()

Since: API level 17

This method hides the Developer options menu item in the Settings menu if it is turned on by the user by clicking multiple times on Build number in Settings menu.

Returns
  • SUCCESS The Developer Options menu item was hidden successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setDeveloperOptionsHidden();
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setEthernetConfiguration (int connectionType, String staticIpAddress, String staticNetmask, String staticDnsAddress, String staticDefaultRouter)

Since: API level 17

This method sets up the Ethernet configuration to either use DHCP or Static IP.
If Static IP is configured, then the relevant parameters need to be provided

Parameters
connectionType ETHERNET_DHCP or ETHERNET_STATIC_IP.
staticIpAddress IP Address for Static IP Config.
staticNetmask Netmask for Static IP Config.
staticDnsAddress DNS Address for Static IP Config.
staticDefaultRouter Default Router for Static IP Config.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setEthernetConfiguration(CustomDeviceManager.ETHERNET_DHCP, null, null, null, null);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setEthernetState (boolean state)

Since: API level 17

This will allow the device to use Ethernet networking via USB. The configuration required depends on the network settings but if you require, you can specify a static IP address which will be used. NOTE: Sometimes the ethernet module takes time to update ethernet state. It is advised to wait before getting the current state.

Parameters
state true to turn Ethernet on, false to turn it off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setEthernetState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setFlightModeState (int state)

Since: API level 19

This method turns flight mode on and off.

Parameters
state ON to turn flight mode on, OFF to turn it off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setFlightModeState(CustomDeviceManager.ON);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 19
Version 2.6
Multiuser Environment
Global Scope

public int setGpsState (boolean state)

Since: API level 17

Deprecated in API level 27

This method turns GPS on and off.

Parameters
state true to turn GPS on, false to turn it off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setGpsState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setInputMethod (String inputMethodClassName, boolean force)

Since: API level 17

This method sets the input method to the specified class. The input type can be added to the list of input types if it does not already exist by setting the force parameter to true.

Parameters
inputMethodClassName The class name of the keyboard/input type to be used.
force true if the new input method should be added to the list of available input types if it doesnt already exist.
false if the method should fail if an non-existent input type is specified.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String inputMethodClassName = "com.example.input/.CustomKeypad";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setInputMethod(inputMethodClassName, true);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setLTESettingState (boolean state)

Since: API level 17

Deprecated in API level 27

This method turns on/off the "LTE Only" menu option in Settings.
NOTE: The device must be rebooted for this change to take effect.

Parameters
state true to turn on LTE-only option, false to turn it off .
Returns
  • SUCCESS The state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setLTESettingState(true);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setMobileDataRoamingState (boolean state)

Since: API level 17

This method turns on/off mobile data roaming.

Parameters
state true to turn on, false to turn off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setMobileDataRoamingState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setMobileDataState (boolean state)

Since: API level 17

This method turns mobile data on or off.

Parameters
state true to turn mobile data on, false to turn it off.
Returns
  • SUCCESS The mobile data state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setMobileDataState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setMotionControlState (int type, boolean state)

Since: API level 17

This method turns on/off the selected motion control.

Parameters
type the control type(s): MOTION and/or PALM_MOTION.
state true to turn on, false to turn off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setMotionControlState(CustomDeviceManager.MOTION, false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setPackageVerifierState (boolean state)

Since: API level 17

This method turns on/off the Google package verifier.

Parameters
state true to turn on, false to turn off.
Returns
  • SUCCESS The state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setPackageVerifierState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setPowerSavingMode (int mode)

Since: API level 17

This method turns on/off the power saving option of the device.
Ultra power saving mode can also be turned on or turned off. When Ultra power saving mode is turned off then device previous power state will be restored.

Parameters
mode One of the following modes:
POWER_SAVING_OFF
POWER_SAVING_ON
POWER_SAVING_ULTRA
POWER_SAVING_ULTRA_OFF - Since Version 2.6
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setPowerSavingMode(CustomDeviceManager.POWER_SAVING_OFF);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setProtectBatteryState (boolean state)

Since: API level 29

This method turns on/off the "Protect battery" menu option in Settings.

Parameters
state true if on, false if off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setProtectBatteryState(true);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 29
Version 3.4
Multiuser Environment
Global Scope

public int setScreenWakeupOnPowerState (boolean state)

Since: API level 17

This method turns on/off whether screen is turned on when power is connected to device.

Parameters
state true to turn on, false to turn off.
Returns
  • SUCCESS The state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setScreenWakeupOnPowerState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setSettingsHiddenState (boolean state, int elements)

Since: API level 17

This method hides or shows UI elements in the Settings app on the device.

Parameters
state true to hide the specified UI elements, false to show them.
elements The specified elements as a mask, or SETTINGS_ALL to hide (or show) all available elements.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setSettingsHiddenState(true, CustomDeviceManager.SETTINGS_WIFI | CustomDeviceManager.SETTINGS_BLUETOOTH);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setStayAwakeState (boolean state)

Since: API level 17

This method turns on/off Stay Awake (screen always on when plugged in).

Parameters
state true to turn on, false to turn off.
Returns
  • SUCCESS The state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setStayAwakeState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setSystemLocale (String localeLanguage, String localeCountry)

Since: API level 17

This method sets the default language and region for the device.

Parameters
localeLanguage Two character lower case language code as defined in ISO 639-1.
localeCountry Two character upper case country code as defined in ISO 3166-1. This can be optionally followed by a hash (#) and a four character script code as defined in ISO 15924.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setSystemLocale("zn", "CH#Hans");
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setUsbDeviceDefaultPackage (UsbDevice usbDevice, String applicationPackage, int applicationUid)

Since: API level 17

This method sets the default application that is to be notified when a USB device is connected. This prevents the user from being shown the prompt which gives permission for the application to use the USB Device.
NOTE: This method needs to be called for each USB device that may be inserted.

Parameters
usbDevice The USB device to be assigned a default application.
applicationPackage The package name of default application allowed to use the USB device.
applicationUid The UID of the default application allowed to use the USB device.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     UsbDevice usbDevice;
     // Assign usbDevice to correct USB device connected to phone/tablet
     String applicationPackage = "com.example.default.packagename";
     int uid = getApplicationInfo().uid;
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setUsbDeviceDefaultPackage(usbDevice, applicationPackage, uid);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setWifiConnectionMonitorState (boolean state)

Since: API level 17

This method turns on/off the Wi-Fi connection monitor.
That is whether a Wi-Fi network is checked for quality of internet connection.

Parameters
state true to turn on, false to turn off.
Returns
  • SUCCESS The state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setWifiConnectionMonitorState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setWifiFrequencyBand (int band)

Since: API level 17

Deprecated in API level 27

This method sets the Wi-Fi frequency band.
If the device does not support dual band, only WIFI_FREQUENCY_BAND_AUTO value is valid and it is set as 2GHZ, it is not possible to use WIFI_FREQUENCY_BAND_2GHZ.
NOTE: The Broadcom BCM4361 chipset used in some devices does not currently support this feature.

Parameters
band One of the following bands:
WIFI_FREQUENCY_BAND_AUTO
WIFI_FREQUENCY_BAND_5GHZ
WIFI_FREQUENCY_BAND_2GHZ
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setWifiFrequencyBand(CustomDeviceManager.WIFI_FREQUENCY_BAND_AUTO);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setWifiState (boolean state, String ssid, String username, String password)

Since: API level 17

This method turns Wi-Fi on or off; and optionally configures a connection to an access point. If the AP credentials are not required, the parameters should be set to null.

Parameters
state true to turn Wi-Fi on, false to turn it off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setWifiState(true, ssid, username, password);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setWifiState (boolean state, String ssid, String password)

Since: API level 17

This method turns Wi-Fi on or off; and optionally configures a connection to an access point. If the AP credentials are not required, the parameters should be set to null.

Parameters
state true to turn Wi-Fi on, false to turn it off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     SettingsManager kcsm = cdm.getSettingsManager();
     kcsm.setWifiState(true, ssid, password);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope