Back to top

Knox SDK frequently asked questions — Samsung DeX

Use the following API:

  • DexManager.setDexDisabled(): to disable (true) or enable (false) DeX display, either through USB or wirelessly, either inside or outside a work profile.

Here is some sample source code to disable all USB interfaces except HID devices like mice and keyboards, and Samsung DeX:

EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
DexManager dexMgr = edm.getDexManager();
dexMgr.setDexDisabled(false);

For information about enabling and disabling USB connections, see How do I specify how a device USB can be used?

Use the following APIs:

  • RestrictionPolicy.allowUsbHostStorage(): to enable or disable USB host storage. If enabled, a user can connect any portable USB storage, external HD, or Secure Digital (SD) card reader, which is mounted as a storage drive on the device. If disabled, the user cannot mount an external storage device.
  • RestrictionPolicy.setUsbExceptionList(): to set the USB class exception list. If set, all USB device classes are blocked except the classes in the exception list.

Examples:

  • Enable only keyboard and mice: allowUsbHostStorage(true), setUsbExceptionList(HID).
  • Enable only Ethernet ports: allowUsbHostStorage(true), setUsbExceptionList(VEN:CDC:COM).
  • Block all USB devices: allowUsbHostStorage(true), setUsbExceptionList(OFF).

Here is some sample source code to disable all USB interfaces except HID devices like mice and keyboards:

EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
// enable only mice and keyboards
RestrictionPolicy restrictionPolicy = edm.getRestrictionPolicy();
restrictionPolicy.setUsbExceptionList(USBInterface.HID.getValue());

For information about enabling and disabling DeX, see How do I enable and disable DeX?

Knox SDK v3.1 and higher provides these API methods to control Samsung DeX features:

  • Enable/disable Samsung DeX Mode
  • Configure Samsung DeX mode screen time out
  • Allow/disallow screen time out change
  • Enforce Ethernet only (block cellular data and Wi-fi)
  • Check if a device is docked to a Samsung DeX station
  • Disable certain application in Samsung DeX mode
  • Add/remove application shortcuts on the Samsung DeX mode home screen
  • Change DeX loading screen
  • Use Ethernet MAC address with device dependent

For details, see the Knox SDK class DexManager.

Yes, customize your Samsung DeX with a personal or company logo to better fit your needs. With Samsung Knox SDK v3.1 and higher, you can use the API method DexManager.setLoadingLogo(ParcelFileDescriptor logoFD) to change your Samsung DeX loading screen.

Yes. Samsung DeX supports both mirroring mode as well as Samsung DeX mode. Both of these display types supports Android work profiles displayed through a device.

In the Knox SDK v3.1 and higher, there are Samsung DeX APIs such as DexManager.addPackageToDisableList(String packageName) to disable packages when connected to Samsung DeX.

In addition, the Knox SDK provides many allowlist and blocklist policies — for example, in the class ApplicationPolicy —  that apply while connected through DeX.

Always follow Android best practices for app development to ensure that your app displays properly with Samsung DeX.

For complete details on how to update your app, see the DeX Developer Guide.

Is this page helpful?