Since: API level 2
public class

BluetoothPolicy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.bluetooth.BluetoothPolicy

Class Overview

This class provides APIs to control Bluetooth settings. The user cannot overwrite any disabled settings provided by this policy.
NOTE:
If Bluetooth Secure mode is enabled, the strictest configuration for all Bluetooth profiles cumulatively set by Bluetooth Policy and Bluetooth Secure Mode Policy will be enforced on device.
Please see BluetoothSecureModePolicy

Since
API level 2
MDM 2.0

Summary

Nested Classes
class BluetoothPolicy.BluetoothProfile This class provides Bluetooth profiles that can be managed by administrators. 
class BluetoothPolicy.BluetoothUUID This class provides Bluetooth UUIDs that an administrator can manage. 
Public Methods
boolean activateBluetoothDeviceRestriction(boolean enable)
API to enable or disable Bluetooth device restriction.
boolean activateBluetoothUUIDRestriction(boolean enable)
API to activate or deactivate Bluetooth UUID restrictions.
boolean addBluetoothDevicesToBlackList(List<String> devices)
API to add devices to the Bluetooth device blacklist.
boolean addBluetoothDevicesToWhiteList(List<String> devices)
API to add a device to the Bluetooth device whitelist.
boolean addBluetoothDevicesToWhiteList(List<String> devices, boolean defaultBlackList)
API to add a device to the Bluetooth device whitelist along with blacklist all other devices, if defaultBlackList is true.
boolean addBluetoothUUIDsToBlackList(List<String> UUIDs)
API to add UUIDs to the Bluetooth UUID blacklist.
boolean addBluetoothUUIDsToWhiteList(List<String> UUIDs)
API to add UUIDs to the Bluetooth UUID whitelist.
boolean addBluetoothUUIDsToWhiteList(List<String> UUIDs, boolean defaultBlackList)
API to add UUIDs to the Bluetooth UUID whitelist along with blacklist all other UUIDs, if defaultBlackList is true.
boolean allowCallerIDDisplay(boolean allow)
API to allow or disallow caller Id display on a connected Bluetooth device.
boolean allowOutgoingCalls(boolean allow)
API to allow or disallow outgoing calls via a Bluetooth headset.
boolean clearBluetoothDevicesFromBlackList()
API for removing all devices from the Bluetooth device blacklist.
boolean clearBluetoothDevicesFromList()
API for removing all devices from the Bluetooth device blacklist and whitelist.
boolean clearBluetoothDevicesFromWhiteList()
API for removing all devices from the Bluetooth device whitelist.
boolean clearBluetoothUUIDsFromBlackList()
API to clear all UUIDs from Bluetooth UUID blacklist.
boolean clearBluetoothUUIDsFromList()
API to clear all UUIDs from Bluetooth UUID blacklist and whitelist.
boolean clearBluetoothUUIDsFromWhiteList()
API to clear all UUIDs from Bluetooth UUID whitelist.
boolean getAllowBluetoothDataTransfer()
API to check whether file sharing via Bluetooth is allowed.
List<BluetoothControlInfo> getBluetoothDevicesFromBlackLists()
API for retrieving the list of blacklisted Bluetooth devices for all administrators.
List<BluetoothControlInfo> getBluetoothDevicesFromWhiteLists()
API for retrieving the list of whitelisted Bluetooth devices for all administrators.
List<String> getBluetoothLog()
API to get the Bluetooth log stored on the device.
List<BluetoothControlInfo> getBluetoothUUIDsFromBlackLists()
API to retrieve the list of blacklisted Bluetooth UUIDs for all administrators.
List<BluetoothControlInfo> getBluetoothUUIDsFromWhiteLists()
API for retrieving the list of whitelisted Bluetooth UUIDs for all administrators.
boolean isBluetoothDeviceRestrictionActive()
API to get active state of the Bluetooth device restriction.
boolean isBluetoothLogEnabled()
API to check whether the Bluetooth log is enabled.
boolean isBluetoothUUIDRestrictionActive()
API to get the activity state of Bluetooth UUID restrictions.
boolean isCallerIDDisplayAllowed()
API to get caller Id display status on a connected Bluetooth device.
boolean isDesktopConnectivityEnabled()
API to check whether the connection via Bluetooth to a desktop or laptop is enabled.
boolean isDiscoverableEnabled()
API to check whether discoverable mode is enabled.
boolean isLimitedDiscoverableEnabled()
API to check whether limited discoverable mode is enabled.
boolean isOutgoingCallsAllowed()
API to check whether outgoing calls are allowed via a Bluetooth headset.
boolean isPairingEnabled()
API to check whether Bluetooth pairing is enabled.
boolean isProfileEnabled(int profile)
API to check whether a specific Bluetooth profile is enabled.
boolean removeBluetoothDevicesFromBlackList(List<String> devices)
API for removing a device from the Bluetooth device blacklist.
boolean removeBluetoothDevicesFromWhiteList(List<String> devices)
API for removing a device from the Bluetooth device whitelist.
boolean removeBluetoothUUIDsFromBlackList(List<String> UUIDs)
API to remove UUIDs from the Bluetooth UUID blacklist.
boolean removeBluetoothUUIDsFromWhiteList(List<String> UUIDs)
API to remove specified UUIDs from Bluetooth UUID whitelist.
boolean setAllowBluetoothDataTransfer(boolean enable)
API to allow or disallow file sharing via Bluetooth.
boolean setBluetoothLogEnabled(boolean enable)
API to enable or disable the Bluetooth log feature.
boolean setDesktopConnectivityState(boolean enable)
API to enable or disable desktop or laptop connection via Bluetooth
boolean setDiscoverableState(boolean enable)
API to enable or disable Bluetooth discoverable mode.
boolean setLimitedDiscoverableState(boolean enable)
API to enable or disable limited discoverable mode.
boolean setPairingState(boolean enable)
API to enable or disable Bluetooth pairing with other Bluetooth devices.
boolean setProfileState(boolean enable, int profile)
API to enable or disable a specific Bluetooth profile.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean activateBluetoothDeviceRestriction (boolean enable)

Since: API level 4

API to enable or disable Bluetooth device restriction.

Parameters
enable true to enable, false to disable
Returns
  • true on success, false on failure
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can call this API to activate or deactivate Bluetooth blacklist and whitelist device restrictions.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean activateBluetoothUUIDRestriction (boolean enable)

Since: API level 4

API to activate or deactivate Bluetooth UUID restrictions.

Parameters
enable true to enable, false to disable
Returns
  • true on success, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. An administrator can use this API to activate or deactivate Bluetooth blacklist and whitelist UUID restrictions.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean addBluetoothDevicesToBlackList (List<String> devices)

Since: API level 4

API to add devices to the Bluetooth device blacklist.

Parameters
devices Bluetooth device to be added to blacklist
Returns
  • true if the device was successfully added to the blacklist, else false
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to blacklist connections based on the Bluetooth device. Connections with matching device are prevented. The device is identified by the MAC address. During specification, only the "*" wildcard is allowed, which blacklists all devices except those in the whitelist. The blacklist takes effect only after being activated using activateBluetoothDeviceRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 //device to be removed from black list.

 List devices = new ArrayList();

 devices.add("00:11:22:33:AA:BB");

 devices.add("00:11:22:88:AA:CC"};

 try {

     boolean result = bluetoothPolicy.addBluetoothDevicesToBlackList(devices);

     if (true == result) {

         //device successfully added to blacklist

     } else {

         //device not added to blacklist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean addBluetoothDevicesToWhiteList (List<String> devices)

Since: API level 4

API to add a device to the Bluetooth device whitelist.

Parameters
devices Bluetooth device to be added to whitelist
Returns
  • true if the device was successfully added to the whitelist else false
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to add connections to a whitelist based on the Bluetooth device. A connection with a matching device is an exception from the blacklist. During specification, only the "*" wildcard is allowed, which adds all devices to the whitelist. If the same UUID is present in the whitelist and blacklist and was added by same administrator, the whitelist takes priority. The whitelist takes effect only after being activated using activateBluetoothDeviceRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 //device to be removed from white list.

 List devices = new ArrayList();

 devices.add("00:11:22:33:AA:BB");

 devices.add("00:11:22:88:AA:CC"};

 try {

     boolean result = bluetoothPolicy.addBluetoothDevicesToWhiteList(devices);

     if (true == result) {

         //device added to whitelist

     } else {

         //device not added to whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean addBluetoothDevicesToWhiteList (List<String> devices, boolean defaultBlackList)

Since: API level 11

API to add a device to the Bluetooth device whitelist along with blacklist all other devices, if defaultBlackList is true.

Parameters
devices Bluetooth device to be added to whitelist
defaultBlackList If true then by default all the devices are blacklisted except whitelisted devices. Bluetooth device to be added to whitelist
Returns
  • true if the device was successfully added to the whitelist else false
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to add connections to a whitelist based on the Bluetooth device. If defaultBlackList is true, then by default all other devices are blacklisted other than whitlisted devices. A connection with a matching device is an exception from the blacklist. During specification, only the "*" wildcard is allowed, which adds all devices to the whitelist. If the same UUID is present in the whitelist and blacklist and was added by same administrator, the whitelist takes priority. The whitelist takes effect only after being activated using activateBluetoothDeviceRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 //device to be removed from white list.

 List devices = new ArrayList();

 devices.add("00:11:22:33:AA:BB");

 devices.add("00:11:22:88:AA:CC"};

 boolean defaultBlackList = true;

 try {

     boolean result = bluetoothPolicy.addBluetoothDevicesToWhiteList(devices,defaultBlackList);

     if (true == result) {

         //device added to whitelist

     } else {

         //device not added to whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean addBluetoothUUIDsToBlackList (List<String> UUIDs)

Since: API level 4

API to add UUIDs to the Bluetooth UUID blacklist.

Parameters
UUIDs Bluetooth UUIDs to be added to blacklist
Returns
  • true if the UUID successfully added to blacklist, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices. For interoperability, two communicating devices must implement a common profile. An administrator can use this API to blacklist connections based on Bluetooth UUIDs. Connections with matching UUID are prevented. During specification, only the "*" Wildcard is allowed, which blacklists all UUIDs except those in the whitelist. The blacklist is in effect only after being activated using activateBluetoothUUIDRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 // UUIDs to be removed from black list.

 List UUIDs = new ArrayList();

 UUIDs.add(BluetoothUUID.HSP_UUID);

 UUIDs.add(BluetoothUUID.HANDSFREE_UUID);

 try {

     boolean result = bluetoothPolicy.addBluetoothUUIDsToBlackList(UUIDs);

     if (true == result) {

         // UUID successfully added to blacklist

     } else {

         // UUID not added to blacklist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean addBluetoothUUIDsToWhiteList (List<String> UUIDs)

Since: API level 4

API to add UUIDs to the Bluetooth UUID whitelist.

Parameters
UUIDs Bluetooth UUIDs to be added to whitelist
Returns
  • true if the UUID successfully added to whitelist, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. This API is used to add UUIDs to the Bluetooth UUID whitelist. Connections with matching UUIDs become exceptions from the blacklist. During specification, only the "*" Wild card is allowed, which whitelists all UUIDs. If the same UUID is present in the whitelist and blacklist and has been added by the same administrator, the whitelist takes preference. The whitelist takes effect only after being activated using activateBluetoothUUIDRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 // UUID to be removed from whitelist.

 List UUIDs = new ArrayList();

 UUIDs.add(BluetoothUUID.HSP_UUID);

 UUIDs.add(BluetoothUUID.HANDSFREE_UUID);

 try {

     boolean result = bluetoothPolicy.addBluetoothUUIDsToWhiteList(UUIDs);

     if (true == result) {

         // UUID successfully added to whitelist

     } else {

         // UUID not added to whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean addBluetoothUUIDsToWhiteList (List<String> UUIDs, boolean defaultBlackList)

Since: API level 11

API to add UUIDs to the Bluetooth UUID whitelist along with blacklist all other UUIDs, if defaultBlackList is true.

Parameters
UUIDs Bluetooth UUIDs to be added to whitelist
defaultBlackList If true then by default all the UUID's are blacklisted except the whitelisted UUID's.
Returns
  • true if the UUID successfully added to whitelist, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. An effectively can use this API to add UUIDs to the Bluetooth UUID whitelist. if defaultBlacklist is true, then by default all other UUID's are blacklisted. Connections with matching UUIDs become exceptions from the blacklist. During specification, only the "*" Wild card is allowed, which whitelists all UUIDs. If the same UUID is present in the whitelist and blacklist and has been added by the same administrator, the whitelist takes preference. The whitelist takes effect only after being activated using activateBluetoothUUIDRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 // UUID to be removed from whitelist.

 List UUIDs = new ArrayList();

 UUIDs.add(BluetoothUUID.HSP_UUID);

 UUIDs.add(BluetoothUUID.HANDSFREE_UUID);

 boolean defaultBlacklist = ture;

 try {

     boolean result = bluetoothPolicy.addBluetoothUUIDsToWhiteList(UUIDs, defaultBlacklist);

     if (true == result) {

         // UUID successfully added to whitelist

     } else {

         // UUID not added to whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean allowCallerIDDisplay (boolean allow)

Since: API level 6

API to allow or disallow caller Id display on a connected Bluetooth device.

Parameters
allow true to allow caller Id display, false to not display caller Id.
Returns
  • true on success, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to allow or disallow caller Id information on a connected Bluetooth device during an incoming call.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();



 try {

     if (bluetoothPolicy.allowCallerIDDisplay(false)) {

         Log.d(TAG, "Caller Id display blocked successfully");

     } else {

         Log.d(TAG, "Failed to block caller Id display");

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean allowOutgoingCalls (boolean allow)

Since: API level 2

API to allow or disallow outgoing calls via a Bluetooth headset.

Parameters
allow true to allow, false to disallow
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to block call transfer to any Bluetooth headset. When this policy is applied, the device can still be discovered and paired. The Bluetooth headset can still control call origination and termination. The policy does not affect incoming calls using a Bluetooth headset. NOTE:
From Android 4.2, this API will block both incoming and outgoing calls.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.allowOutgoingCalls(false);

     if (true == result) {

         // administered device cannot be connected to Bluetooth headset.

     } else {

         // default behaviour. Can be connected to a Bluetooth Headset if

         // not overridden previously.

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean clearBluetoothDevicesFromBlackList ()

Since: API level 4

API for removing all devices from the Bluetooth device blacklist.

Returns
  • true if all the devices successfully cleared from the blacklist else false
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to remove all Bluetooth devices from the blacklist. The blacklist takes effect only after being activated using activateBluetoothDeviceRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.clearBluetoothDevicesFromBlackList();

     if (true == result) {

         // all devices cleared from blacklist

     } else {

         // devices not cleared from blacklist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean clearBluetoothDevicesFromList ()

Since: API level 11

API for removing all devices from the Bluetooth device blacklist and whitelist.

Returns
  • true if all the devices successfully cleared from the blacklist and whitelist else false
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to remove all Bluetooth devices from the blacklist and whitelist. The blacklist and whitelist takes effect only after being activated using activateBluetoothDeviceRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.clearBluetoothDevicesFromList();

     if (true == result) {

         // all devices cleared from blacklist and whitelist

     } else {

         // devices not cleared from blacklist and whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean clearBluetoothDevicesFromWhiteList ()

Since: API level 4

API for removing all devices from the Bluetooth device whitelist.

Returns
  • true if all the devices successfully cleared from the whitelist else false
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to remove all Bluetooth devices from the whitelist. The whitelist takes effect only after being activated using activateBluetoothDeviceRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.clearBluetoothDevicesFromWhiteList();

     if (true == result) {

         // all devices cleared from the whitelist

     } else {

         // devices not cleared from the whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean clearBluetoothUUIDsFromBlackList ()

Since: API level 4

API to clear all UUIDs from Bluetooth UUID blacklist.

Returns
  • true if the UUIDs are successfully cleared from blacklist, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. This API removes all Bluetooth UUIDs from the blacklist for calling administrators. The blacklist is in effect only after being activated using activateBluetoothUUIDRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.clearBluetoothUUIDsFromBlackList();

     if (true == result) {

         // all UUIDs successfully cleared from blacklist

     } else {

         // all UUIDs not cleared from blacklist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean clearBluetoothUUIDsFromList ()

Since: API level 11

API to clear all UUIDs from Bluetooth UUID blacklist and whitelist.

Returns
  • true if the UUIDs are successfully cleared from blacklist and whitelist, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. This API removes all Bluetooth UUIDs from the blacklist and whitelist for calling administrators. The blacklist and whitelist is in effect only after being activated using activateBluetoothUUIDRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.clearBluetoothUUIDsFromList();

     if (true == result) {

         // all UUIDs successfully cleared from blacklist and whitelist

     } else {

         // all UUIDs not cleared from blacklist and whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean clearBluetoothUUIDsFromWhiteList ()

Since: API level 4

API to clear all UUIDs from Bluetooth UUID whitelist.

Returns
  • true if the UUIDs are successfully cleared from whitelist, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. An administrator can use this API to remove all Bluetooth UUIDs from the whitelist. All exceptions due to the whitelist are removed for the same administrator. The whitelist takes effect only after being activated using activateBluetoothUUIDRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.clearBluetoothUUIDsFromWhiteList();

     if (true == result) {

         // all UUIDs cleared from whitelist

     } else {

         // all UUIDs not cleared from whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean getAllowBluetoothDataTransfer ()

Since: API level 2

API to check whether file sharing via Bluetooth is allowed.

Returns
  • true if file sharing via Bluetooth is allowed, false if file sharing via Bluetooth is disallowed
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public List<BluetoothControlInfo> getBluetoothDevicesFromBlackLists ()

Since: API level 4

API for retrieving the list of blacklisted Bluetooth devices for all administrators.

Returns
  • Blacklisted devices for all administrators or null if operation failed.
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to get the list of blacklisted devices. Connections with matching devices are prevented.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public List<BluetoothControlInfo> getBluetoothDevicesFromWhiteLists ()

Since: API level 4

API for retrieving the list of whitelisted Bluetooth devices for all administrators.

Returns
  • Whitelisted devices for all administrators if it succeeds else null.
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to get the list of whitelisted devices for all administrators.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public List<String> getBluetoothLog ()

Since: API level 5

API to get the Bluetooth log stored on the device.

Returns
  • List of entries recorded in the bluetooth log. Returns null on failure.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can call this API to get log contents. The log size is limited to 1000 entries (the newest entries rewrite the oldest entries). The log is automatically cleared when this policy is disabled.


// Sample Output
1313632503413:[Device Visible]
Local Address: 43:34:B0:00:00:00
Local Name: GT-I9100

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public List<BluetoothControlInfo> getBluetoothUUIDsFromBlackLists ()

Since: API level 4

API to retrieve the list of blacklisted Bluetooth UUIDs for all administrators.

Returns
  • String array of the blacklisted UUIDs for the calling administrator if it succeeds, else null.
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. An administrator can use this API to get the list of UUIDs that are blacklisted by all administrators.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public List<BluetoothControlInfo> getBluetoothUUIDsFromWhiteLists ()

Since: API level 4

API for retrieving the list of whitelisted Bluetooth UUIDs for all administrators.

Returns
  • String array of the whitelisted UUIDs for the calling administrator if it succeeds, else null.
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. An administrator can use this API to get the list of whitelisted UUIDs. Connections with matching devices are allowed.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean isBluetoothDeviceRestrictionActive ()

Since: API level 4

API to get active state of the Bluetooth device restriction.

Returns
  • true if enabled and false otherwise
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to check whether Bluetooth device restriction is active.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean isBluetoothLogEnabled ()

Since: API level 5

API to check whether the Bluetooth log is enabled.

Returns
  • true if enabled, false if disabled.
Usage
This policy supports multiple administrators. The policy is enabled when at least one administrator enables it. The policy is disabled when all administrators disable it. By default, this feature is disabled.
Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public boolean isBluetoothUUIDRestrictionActive ()

Since: API level 4

API to get the activity state of Bluetooth UUID restrictions.

Returns
  • true if enabled, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. An administrator can check whether Bluetooth UUID restriction is active.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean isCallerIDDisplayAllowed ()

Since: API level 6

API to get caller Id display status on a connected Bluetooth device.

Returns
  • true if caller id display is allowed on connected Bluetooth device during incoming call, else false.
Usage
An administrator can use this API to determine whether caller Id display is allowed on a connected Bluetooth device during an incoming call.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();



 try {

     if (bluetoothPolicy.isCallerIDDisplayAllowed()) {

         Log.d(TAG, "caller Id display allowed on call ");

     } else {

         Log.w(TAG, "caller Id display not allowed on call");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 

Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean isDesktopConnectivityEnabled ()

Since: API level 2

API to check whether the connection via Bluetooth to a desktop or laptop is enabled.

Returns
  • true if enabled, false if disabled
Usage
An administrator can use this API to check whether the connection via Bluetooth to a desktop or laptop is enabled. By default, this API returns true.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean isDiscoverableEnabled ()

Since: API level 2

API to check whether discoverable mode is enabled.

Returns
  • true if enabled, false if disabled
Usage
An administrator can use this API to check whether discoverable mode is enabled. By default, this API returns true.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean isLimitedDiscoverableEnabled ()

Since: API level 2

API to check whether limited discoverable mode is enabled.

Returns
  • true if limited discoverable mode is enabled, false if limited discoverable mode is disabled
Usage
An administrator can use this API to check whether limited discoverable mode is enabled. If limited discoverable mode is disabled, Bluetooth is always in discoverable mode when turned on. By default, this API returns true, and device is in limited discoverable mode (i.e., device can be discovered by other devices for a limited period of time). The default duration value is 120 seconds.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean isOutgoingCallsAllowed ()

Since: API level 2

API to check whether outgoing calls are allowed via a Bluetooth headset.

Returns
  • true if outgoing calls are allowed, false if outgoing calls are not allowed
Usage
An administrator can use this API to check whether outgoing calls are enabled via a Bluetooth headset. By default, this API returns true.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean isPairingEnabled ()

Since: API level 2

API to check whether Bluetooth pairing is enabled.

Returns
  • true if Bluetooth pairing is enabled, false if Bluetooth pairing is disabled
Usage
An administrator can use this API to check whether Bluetooth pairing is enabled. By default, this API returns true.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean isProfileEnabled (int profile)

Since: API level 2

API to check whether a specific Bluetooth profile is enabled.

Parameters
profile profile setting configuration needed. See BluetoothPolicy.BluetoothProfile
Returns
  • true if enabled, false if disabled
Usage
An administrator can use this API to check whether a specific Bluetooth profile is enabled. By default, this API returns true.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean removeBluetoothDevicesFromBlackList (List<String> devices)

Since: API level 4

API for removing a device from the Bluetooth device blacklist.

Parameters
devices Bluetooth device to be removed from blacklist
Returns
  • true if the device was successfully removed from the blacklist, else false
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to remove a Bluetooth device from the blacklist. Connections with matching devices are then allowed. The blacklist takes effect only after being activated using activateBluetoothDeviceRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 //device to be removed from black list.

 List devices = new ArrayList();

 devices.add("00:11:22:33:AA:BB");

 devices.add("00:11:22:88:AA:CC"};

 try {

     boolean result = bluetoothPolicy.removeBluetoothDevicesFromBlackList(devices);

     if (true == result) {

         //device successfully removed from blacklist

     } else {

         //device not removed from blacklist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean removeBluetoothDevicesFromWhiteList (List<String> devices)

Since: API level 4

API for removing a device from the Bluetooth device whitelist.

Parameters
devices Bluetooth device to be removed from whitelist
Returns
  • true if the device was successfully removed from the whitelist else false
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to remove a Bluetooth device from the whitelist. The whitelist takes effect only after being activated using activateBluetoothDeviceRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 //device to be removed from white list.

 List devices = new ArrayList();

 devices.add("00:11:22:33:AA:BB");

 devices.add("00:11:22:88:AA:CC"};

 try {

     boolean result = bluetoothPolicy.removeBluetoothDevicesFromWhiteList(devices);

     if (true == result) {

         //device successfully removed from whitelist

     } else {

         //device not removed from whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean removeBluetoothUUIDsFromBlackList (List<String> UUIDs)

Since: API level 4

API to remove UUIDs from the Bluetooth UUID blacklist.

Parameters
UUIDs Bluetooth UUIDs to be removed from blacklist
Returns
  • true if the UUID successfully removed from blacklist, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. An administrator can use this API to remove Bluetooth UUIDs from the blacklist after they were added by addBluetoothUUIDsToBlackList(List). Connections with matching UUID are allowed after this API call. The blacklist is in effect only after being activated using activateBluetoothUUIDRestriction(boolean).


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 // UUIDs to be removed from black list.

 List UUIDs = new ArrayList();

 UUIDs.add(BluetoothUUID.HSP_UUID);

 UUIDs.add(BluetoothUUID.HANDSFREE_UUID);

 try {

     boolean result = bluetoothPolicy.removeBluetoothUUIDsFromBlackList(UUIDs);

     if (true == result) {

         // UUID removed successfully from blacklist

     } else {

         // UUID not removed from blacklist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean removeBluetoothUUIDsFromWhiteList (List<String> UUIDs)

Since: API level 4

API to remove specified UUIDs from Bluetooth UUID whitelist.

Parameters
UUIDs Bluetooth UUIDs to be removed from whitelist
Returns
  • true if the UUID is successfully removed from the whitelist, else false
Throws
SecurityException If caller does not have required permissions
Usage

Bluetooth UUIDs represent features offered by devices and are used for interoperability between devices during communication. An administrator can use this API to remove Bluetooth UUIDs from the whitelist. Connections with matching UUID are allowed. If the same UUID is present in the whitelist and blacklist and was added by the same administrator, the whitelist takes preference. The whitelist takes effect only after being activated using activateBluetoothUUIDRestriction.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 // UUID to be removed from whitelist.

 List UUIDs = new ArrayList();

 UUIDs.add(BluetoothUUID.HSP_UUID);

 UUIDs.add(BluetoothUUID.HANDSFREE_UUID);

 try {

     boolean result = bluetoothPolicy.removeBluetoothUUIDsFromWhiteList(UUIDs);

     if (true == result) {

         // UUID successfully removed from whitelist

     } else {

         // UUID not removed from whitelist

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 4
MDM 2.2
Multiuser Environment
Global Scope

public boolean setAllowBluetoothDataTransfer (boolean enable)

Since: API level 2

API to allow or disallow file sharing via Bluetooth.

Parameters
enable true to allow file sharing via Bluetooth, false to disallow file sharing via Bluetooth
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to block any kind of file sharing via Bluetooth, either sending or receiving a file.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.setAllowBluetoothDataTransfer(false);

     if (true == result) {

         // any file sharing through Bluetooth fails

     } else {

         // policy is not applied and previous state prevails

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setBluetoothLogEnabled (boolean enable)

Since: API level 5

API to enable or disable the Bluetooth log feature.

Parameters
enable true to enable, false to disable
Returns
  • true if bluetooth log was successfully enabled/disabled, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to log all Bluetooth connections, which includes the profile used, the IDs of the paired devices, the name and path of files exchanged, and the time that the user enabled discovery mode. The log size is limited to 1000 entries (the newest entries rewrite the oldest entries). The log is automatically cleared when this policy is disabled. The administrator can use getBluetoothLog() to get the Bluetooth log stored on the device.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.setBluetoothLogEnabled(true);

     if (true == result) {

         // log is enabled

     } else {

         // log is not enabled

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public boolean setDesktopConnectivityState (boolean enable)

Since: API level 2

API to enable or disable desktop or laptop connection via Bluetooth

Parameters
enable true to enable, false to disable
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to block Bluetooth connection with a desktop or laptop. The API blocks device pairing with any kind of Bluetooth devices falling into the category of desktop or laptop.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.setDesktopConnectivityState(false);

     if (true == result) {

         // administered device cannot be connected to any Bluetooth devices falling into

         // the desktop or laptop category

     } else {

         // default behaviour - can be connected to other Bluetooth devices

         // in a computer category if not overridden previously

         // with any other value.

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setDiscoverableState (boolean enable)

Since: API level 2

API to enable or disable Bluetooth discoverable mode.

Parameters
enable true to enable, false to disable
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to silently enable or disable Bluetooth discoverable mode. When disabled, the Bluetooth device can never be set in discoverable mode.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.setDiscoverableState(false);

     if (true == result) {

         // administered device cannot be discovered with any Bluetooth devices

     } else {

         // default behaviour - can be discovered by other Bluetooth devices

         // if not overridden previously with any other value.

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setLimitedDiscoverableState (boolean enable)

Since: API level 2

API to enable or disable limited discoverable mode.

Parameters
enable true to enable, false to disable
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to silently enable or disable limited discoverable mode. If limited discoverable mode is disabled, Bluetooth is always be in discoverable mode when turned on. By default, the device is in limited discoverable mode (i.e., device can be discovered by other devices for limited period of time). The default duration value is 120 seconds.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.setLimitedDiscoverableState(false);

     if (true == result) {

         // administered device can be always discovered.

     } else {

         // default behaviour - discoverable for 120 second if not overridden

         // previously with any other value.

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setPairingState (boolean enable)

Since: API level 2

API to enable or disable Bluetooth pairing with other Bluetooth devices.

Parameters
enable true to enable, false to disable
Returns
  • true on success, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to block pairing with any kind of Bluetooth devices, although devices can still be discovered. Any devices already paired will continue with same pairing state and if it is unpaired by user then user cannot pair it again.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     boolean result = bluetoothPolicy.setPairingState(false);

     if (true == result) {

         // administrator device cannot be paired with any other Bluetooth devices.

     } else {

         // default behavior - can be paired with other Bluetooth devices, if not overridden

         // previously

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setProfileState (boolean enable, int profile)

Since: API level 2

API to enable or disable a specific Bluetooth profile. For specific profiles, see BluetoothPolicy.BluetoothProfile.

Parameters
enable true to enable, false to disable
profile Profile setting to be configured
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to silently enable or disable a specific Bluetooth profile. Example :BluetoothProfile.BLUETOOTH_HSP_PROFILE BluetoothProfile.BLUETOOTH_HFP_PROFILE BluetoothProfile.BLUETOOTH_A2DP_PROFILE


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothPolicy bluetoothPolicy = edm.getBluetoothPolicy();

 try {

     // Block Bluetooth headset devices

     boolean result = bluetoothPolicy.setProfileState(false,

             BluetoothProfile.BLUETOOTH_HSP_PROFILE);

     if (true == result) {

         // administered device cannot be paired with any Bluetooth headset

         // devices

     } else {

         // default behaviour - can be paired with Bluetooth headset devices

         // if not overridden previously with any other value.

     }



     // Block Bluetooth hands-free devices connection

     result = bluetoothPolicy.setProfileState(false,

             BluetoothProfile.BLUETOOTH_HFP_PROFILE);

     if (true == result) {

         // administered device cannot be paired with any Bluetooth hands-free

         // devices

     } else {

         // default behaviour - can be paired with Bluetooth handsfree devices

         // if not overridden previously with any other value.

     }



     // Block Bluetooth A2DP supported devices connection

     result = bluetoothPolicy.setProfileState(false,

             BluetoothProfile.BLUETOOTH_A2DP_PROFILE);

     if (true == result) {

         // administered device cannot be paired with any Bluetooth a2dp

         // devices

     } else {

         // default behavior - can be paired with Bluetooth a2dp devices

         // if not overridden previously with any other value.

     }

 } 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_BLUETOOTH" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope