Since: API level 2
public class

PhoneRestrictionPolicy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.restriction.PhoneRestrictionPolicy

Class Overview

This class provides APIs to control telephony functionality settings.

Since
API level 2
MDM 2.0

Summary

Constants
String ACTION_RCS_MSG_FILE_RECEIVED Broadcast Action: Intent to notify a new RCS file is received.
String ACTION_RCS_MSG_FILE_SENT Broadcast Action: Intent to notify a new RCS file is sent.
String ACTION_RCS_MSG_FILE_THUMBNAIL_RECEIVED Broadcast Action: Intent to notify a new RCS thumbnail is received.
String ACTION_RCS_MSG_TEXT_RECEIVED Broadcast Action: Intent to notify a new RCS message is received.
String ACTION_RCS_MSG_TEXT_SENT Broadcast Action: Intent to notify a new RCS message is sent.
String BODY This constant is a key to fetch RCS message's body from Bundle returned by getRCSMessage(long).
String CONTENT_TYPE This constant is a key to fetch RCS message's content type from Bundle returned by getRCSMessage(long).
int ERROR_INVALID_INPUT Flag to indicate that API failed because of invalid input
int ERROR_NONE Flag to indicate that API applied policy successfully
int ERROR_NOT_SUPPORTED Flag to indicate that API failed because of not supported.
int ERROR_SIM_NOT_INSERTED Flag to indicate that the specified SIM card is not inserted on the current device
int ERROR_SIM_PIN_ALREADY_LOCKED Flag to indicate that SIM PIN lock is already enabled but not by the administrator.
int ERROR_SIM_PIN_ALREADY_LOCKED_BY_ADMIN Flag to indicate that SIM PIN lock is already enabled by the current administrator.
int ERROR_SIM_PIN_ALREADY_UNLOCKED Flag to indicate that SIM PIN lock is already disabled.
int ERROR_SIM_PIN_BLOCKED_BY_PUK Flag to indicate that SIM card is locked by a PIN unlock key (PUK).
int ERROR_SIM_PIN_DATABASE Flag to indicate a database error occurred.
int ERROR_SIM_PIN_FAILED Flag to indicate that a SIM PIN operation failed with a generic error.
int ERROR_SIM_PIN_ID_NOT_READY Flag to indicate that the SIM card is not ready yet.
int ERROR_SIM_PIN_INCORRECT_CODE Flag to indicate that a wrong SIM PIN value was supplied.
int ERROR_SIM_PIN_INVALID_CODE Flag to indicate that an invalid SIM PIN value was supplied.
int ERROR_SIM_PIN_MAX_RETRIES_EXCEEDED Flag to indicate that the maximum number of SIM PIN operations attempts with the wrong PIN code has been reached.
int ERROR_SIM_PIN_NONE Flag to indicate that a subscriber identiy module (SIM) personal identification number (PIN) operation completed successfully.
int ERROR_SIM_PIN_OWNED_BY_OTHER_ADMIN Flag to indicate that another administrator has already locked the SIM card on the current device.
int ERROR_SIM_PIN_UNKNOWN Flag to indicate that an unknown error occurred.
int ERROR_UNKNOWN Flag to indicate that API failed for an unknown reason
String EXTRA_MSG_ID Used as an long extra field with ACTION_RCS_MSG_TEXT_RECEIVED, ACTION_RCS_MSG_TEXT_SENT, ACTION_RCS_MSG_FILE_THUMBNAIL_RECEIVED, ACTION_RCS_MSG_FILE_RECEIVED and ACTION_RCS_MSG_FILE_SENT.
String FILE_PATH This constant is a key to fetch file path of RCS message from Bundle returned by getRCSMessage(long).
int LIMIT_NUMBER_OF_CALLS_BY_DAY Flag to be used to retrieve the number of incoming or outgoing calls allowed by day.
int LIMIT_NUMBER_OF_CALLS_BY_MONTH Flag to be used to retrieve the number of incoming or outgoing calls allowed by month.
int LIMIT_NUMBER_OF_CALLS_BY_WEEK Flag to be used to retrieve the number of incoming or outgoing calls allowed by week.
int LIMIT_NUMBER_OF_DATA_CALLS_BY_DAY Flag to be used to retrieve the amount of data packets sent or received allowed by day.
int LIMIT_NUMBER_OF_DATA_CALLS_BY_MONTH Flag to be used to retrieve the amount of data packets sent or received allowed by month.
int LIMIT_NUMBER_OF_DATA_CALLS_BY_WEEK Flag to be used to retrieve the amount of data packets sent or received allowed by week.
int LIMIT_NUMBER_OF_SMS_BY_DAY Flag to be used to retrieve the number of sent or received Short Message Service (SMS) text messages allowed by day.
int LIMIT_NUMBER_OF_SMS_BY_MONTH Flag to be used to retrieve the number of sent or received Short Message Service (SMS) text messages allowed by month.
int LIMIT_NUMBER_OF_SMS_BY_WEEK Flag to be used to retrieve the number of sent or received Short Message Service (SMS) text messages allowed by week.
int RCS_FEATURE_ALL Flag to indicate that all RCS feature which contains call and message.
String REMOTE_URI Used as an String extra field with the return value of getRCSMessage(long).
String SENDER_ALIAS This constant is a key to fetch sender's alias of RCS message from Bundle returned by getRCSMessage(long).
String THUMBNAIL_PATH This constant is a key to fetch thumbnail path of RCS message from Bundle returned by getRCSMessage(long).
String TIMESTAMP This constant is a key to fetch RCS message's received or sent timestamp from Bundle returned by getRCSMessage(long).
Public Methods
boolean addIncomingCallExceptionPattern(String pattern)
API to add an exception pattern to the administrator's exception pattern set for incoming calls.
boolean addIncomingCallRestriction(String pattern)
API to add a restriction pattern to the administrator's restriction pattern set for incoming calls.
boolean addIncomingSmsExceptionPattern(String pattern)
API to add an exception pattern to the administrator's exception pattern set for incoming SMSs.
boolean addIncomingSmsRestriction(String pattern)
API to add a restriction pattern to the administrator restriction pattern set for incoming Short Message Service (SMS) text messages.
boolean addOutgoingCallExceptionPattern(String pattern)
API to add an exception pattern to the administrator's exception pattern set for outgoing calls.
boolean addOutgoingCallRestriction(String pattern)
API to add a restriction pattern to the administrator's restriction pattern set for outgoing calls.
boolean addOutgoingSmsExceptionPattern(String pattern)
API to add an exception pattern to the administrator's exception pattern set for outgoing SMSs.
boolean addOutgoingSmsRestriction(String pattern)
API to add a restriction pattern to the administrator restriction pattern set for outgoing Short Message Service (SMS) text messages.
boolean allowCallerIDDisplay(boolean allow)
API to allow or disallow caller Id display during an incoming call.
boolean allowCopyContactToSim(boolean allow)
API to enable / disable Copy contact from device to SIM Card.
boolean allowIncomingMms(boolean allow)
Deprecated in API level 35
boolean allowIncomingSms(boolean allow)
Deprecated in API level 35
boolean allowOutgoingMms(boolean allow)
Deprecated in API level 35
boolean allowOutgoingSms(boolean allow)
Deprecated in API level 35
boolean allowWapPush(boolean allow)
Deprecated in API level 33
boolean blockMmsWithStorage(boolean block)
API to allow or disallow storage of blocked incoming Multimedia Message Service (MMS) messages.
boolean blockSmsWithStorage(boolean block)
API to allow or disallow storage of blocked incoming Short Message Service (SMS) text messages.
boolean canIncomingCall(String dialNumber)
API to check if a given dial number for incoming call matches the incoming call restriction pattern.
boolean canIncomingSms(String phoneNumber)
API to check whether an incoming Short Message Service (SMS) text message from a given number is allowed.
boolean canOutgoingCall(String dialNumber)
API to check if a given dial number for an outgoing call matches the outgoing call restriction pattern.
boolean canOutgoingSms(String phoneNumber)
API to check whether an outgoing Short Message Service (SMS) text message to a given number is allowed.
int changeSimPinCode(String currentPinCode, String newPinCode)
API to change SIM card's PIN code.
boolean clearStoredBlockedMms()
API that clears all stored, blocked Multimedia Message Service (MMS) messages.
boolean clearStoredBlockedSms()
API that clears all stored, blocked Short Message Service (SMS) text messages.
int disableSimPinLock(String pinCode)
API to disable SIM card's PIN lock.
boolean enableLimitNumberOfCalls(boolean status)
API to enable or disable limiting the number of calls.
boolean enableLimitNumberOfSms(boolean status)
API to enable or disable limiting the number of Short Message Service (SMS) text messages.
int enableSimPinLock(String pinCode)
API to enable SIM card's PIN lock.
boolean getDataCallLimitEnabled()
API to check whether a limit on carrier data network usage is enabled.
String getDisclaimerText()
Deprecated in API level 35
boolean getEmergencyCallOnly(boolean allAdmins)
API to check whether emergency calls only are allowed on the device.
String getIncomingCallExceptionPatterns()
API to get the exception pattern for incoming calls.
String getIncomingCallRestriction(boolean allAdmins)
API to get the restriction pattern for incoming calls.
String getIncomingSmsExceptionPatterns()
API to get the exception pattern for incoming SMSs.
String getIncomingSmsRestriction(boolean allAdmins)
API to get the restriction pattern for incoming Short Message Service (SMS) text messages.
long getLimitOfDataCalls(int type)
API to get the limits on data packet usage per day, week, or month.
int getLimitOfIncomingCalls(int type)
API to get the limit of incoming calls for a day, week, or month.
int getLimitOfIncomingSms(int type)
API to get the limit on incoming Short Message Service (SMS) text messages for a day, week, or month.
int getLimitOfOutgoingCalls(int type)
API to get the limit on the number of outgoing calls for a day, week, and month.
int getLimitOfOutgoingSms(int type)
API to get the limit on outgoing Short Message Service (SMS) text messages for a day, week, or month.
String getOutgoingCallExceptionPatterns()
API to get the exception pattern for outgoing calls.
String getOutgoingCallRestriction(boolean allAdmins)
API to get the restriction pattern for outgoing calls.
String getOutgoingSmsExceptionPatterns()
API to get the exception pattern for outgoing SMSs.
String getOutgoingSmsRestriction(boolean allAdmins)
API to get the restriction pattern for outgoing Short Message Service (SMS) text messages.
Bundle getRCSMessage(long id)
Deprecated in API level 35
boolean isBlockMmsWithStorageEnabled()
API to check whether storage of blocked incoming Multimedia Message Service (MMS) messages is enabled.
boolean isBlockSmsWithStorageEnabled()
API to check whether storage of blocked incoming Short Message Service (SMS) text messages is enabled.
boolean isCallerIDDisplayAllowed()
API to get the display status of caller Id during an incoming call.
boolean isCopyContactToSimAllowed()
API to check whether the copy.
boolean isIncomingMmsAllowed()
API to determine whether incoming Multimedia Messaging Service (MMS) messages are allowed.
boolean isIncomingSmsAllowed()
API to determine whether incoming Short Message Service (SMS) text messages are allowed.
boolean isLimitNumberOfCallsEnabled()
API to check whether the number of calls is limited.
boolean isLimitNumberOfSmsEnabled()
API to check whether the number of Short Message Service (SMS) text messages is limited.
boolean isOutgoingMmsAllowed()
API to determine whether outgoing Multimedia Messaging Service (MMS) messages are allowed.
boolean isOutgoingSmsAllowed()
API to determine whether outgoing Short Message Service (SMS) text messages are allowed.
boolean isRCSEnabled(int feature)
API to check whether Rich Communication Services (RCS) feature is enabled or not.
boolean isWapPushAllowed()
Deprecated in API level 33
boolean removeIncomingCallExceptionPattern()
API to remove the exception pattern (concatenated or not) for incoming calls set by the device administrators.
boolean removeIncomingCallRestriction()
API to remove the restriction pattern for incoming calls set by the calling administrator.
boolean removeIncomingSmsExceptionPattern()
API to remove the exception pattern (concatenated or not) for incoming SMSs set by the device administrators.
boolean removeIncomingSmsRestriction()
API to remove the restriction pattern for incoming Short Message Service (SMS) text messages set by the calling administrator.
boolean removeOutgoingCallExceptionPattern()
API to remove the exception pattern (concatenated or not) for outgoing calls set by the device administrators.
boolean removeOutgoingCallRestriction()
API to remove the restriction pattern for outgoing calls set by the calling administrator.
boolean removeOutgoingSmsExceptionPattern()
API to remove the exception pattern (concatenated or not) for incoming SMSs set by the device administrators.
boolean removeOutgoingSmsRestriction()
API to remove the restriction pattern for outgoing Short Message Service (SMS) text messages set by the calling administrator.
boolean resetCallsCount()
API to reset the counters for incoming and outgoing calls.
boolean resetDataCallLimitCounter()
API to reset the counters for data usage limits sent and received on device.
boolean resetSmsCount()
API to reset the counters for incoming or outgoing Short Message Service (SMS) text messages.
boolean setDataCallLimitEnabled(boolean status)
API to enable a limit on data carrier network usage on the device.
boolean setDisclaimerText(String text)
Deprecated in API level 35
boolean setEmergencyCallOnly(boolean enable)
API to enable or disable emergency calls only on device.
boolean setIncomingCallExceptionPattern(String pattern)
API to set an exception pattern to be matched by incoming call numbers.
boolean setIncomingCallRestriction(String pattern)
API to set a restriction pattern to be matched by incoming call numbers.
boolean setIncomingSmsExceptionPattern(String pattern)
API to set an exception pattern to be matched by incoming SMS numbers.
boolean setIncomingSmsRestriction(String pattern)
API to set incoming Short Message Service (SMS) text message restriction pattern for the calling administrator.
boolean setLimitOfDataCalls(long limitByDay, long limitByWeek, long limitByMonth)
API to set the limit on data packet usage per day, week, and month.
boolean setLimitOfIncomingCalls(int limitByDay, int limitByWeek, int limitByMonth)
API to set the limit for the number of incoming calls per day, week, and month.
boolean setLimitOfIncomingSms(int limitByDay, int limitByWeek, int limitByMonth)
API to set a limit on the number of incoming Short Message Service (SMS) text messages per day, week, and month.
boolean setLimitOfOutgoingCalls(int limitByDay, int limitByWeek, int limitByMonth)
API to set the limit for the number of outgoing calls per day, week, and month.
boolean setLimitOfOutgoingSms(int limitByDay, int limitByWeek, int limitByMonth)
API to set a limit of number of outgoing Short Message Service (SMS) text messages per day, week, and month.
boolean setOutgoingCallExceptionPattern(String pattern)
API to set an exception pattern to be matched by outgoing call numbers.
boolean setOutgoingCallRestriction(String pattern)
API to set a restriction pattern to be matched by outgoing call numbers.
boolean setOutgoingSmsExceptionPattern(String pattern)
API to set an exception pattern to be matched by outgoing SMS numbers.
boolean setOutgoingSmsRestriction(String pattern)
API to set the outgoing Short Message Service (SMS) text message restriction pattern for the calling administrator.
int setRCSEnabled(int feature, boolean enable)
API to enable or disable Rich Communication Services (RCS) features on device native message apps(e.g.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_RCS_MSG_FILE_RECEIVED

Since: API level 26

Broadcast Action: Intent to notify a new RCS file is received. The intent will have the following extra value: EXTRA_MSG_ID

Permission
Receiver must hold "com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a protection level of signature.
Since
API level 26
KNOX 3.2
See Also
  • # getRCSMessage(long id)
Constant Value: "com.samsung.android.knox.intent.action.RCS_MSG_FILE_RECEIVED"

public static final String ACTION_RCS_MSG_FILE_SENT

Since: API level 26

Broadcast Action: Intent to notify a new RCS file is sent. The intent will have the following extra value: EXTRA_MSG_ID

Permission
Receiver must hold "com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a protection level of signature.
Since
API level 26
KNOX 3.2
See Also
  • # getRCSMessage(long id)
Constant Value: "com.samsung.android.knox.intent.action.RCS_MSG_FILE_SENT"

public static final String ACTION_RCS_MSG_FILE_THUMBNAIL_RECEIVED

Since: API level 26

Broadcast Action: Intent to notify a new RCS thumbnail is received. The intent will have the following extra value: EXTRA_MSG_ID

Permission
Receiver must hold "com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a protection level of signature.
Since
API level 26
KNOX 3.2
See Also
  • # getRCSMessage(long id)
Constant Value: "com.samsung.android.knox.intent.action.RCS_MSG_FILE_THUMBNAIL_RECEIVED"

public static final String ACTION_RCS_MSG_TEXT_RECEIVED

Since: API level 26

Broadcast Action: Intent to notify a new RCS message is received. The intent will have the following extra value: EXTRA_MSG_ID

Permission
Receiver must hold "com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a protection level of signature.
Since
API level 26
KNOX 3.2
See Also
  • # getRCSMessage(long id)
Constant Value: "com.samsung.android.knox.intent.action.RCS_MSG_TEXT_RECEIVED"

public static final String ACTION_RCS_MSG_TEXT_SENT

Since: API level 26

Broadcast Action: Intent to notify a new RCS message is sent. The intent will have the following extra value: EXTRA_MSG_ID

Permission
Receiver must hold "com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a protection level of signature.
Since
API level 26
KNOX 3.2
See Also
  • # getRCSMessage(long id)
Constant Value: "com.samsung.android.knox.intent.action.RCS_MSG_TEXT_SENT"

public static final String BODY

Since: API level 26

This constant is a key to fetch RCS message's body from Bundle returned by getRCSMessage(long).

Since
API level 26
KNOX 3.2
Constant Value: "body"

public static final String CONTENT_TYPE

Since: API level 26

This constant is a key to fetch RCS message's content type from Bundle returned by getRCSMessage(long).

Since
API level 26
KNOX 3.2
Constant Value: "content-type"

public static final int ERROR_INVALID_INPUT

Since: API level 24

Flag to indicate that API failed because of invalid input

Since
API level 24
Constant Value: -1 (0xffffffff)

public static final int ERROR_NONE

Since: API level 24

Flag to indicate that API applied policy successfully

Since
API level 24
Constant Value: 0 (0x00000000)

public static final int ERROR_NOT_SUPPORTED

Since: API level 24

Flag to indicate that API failed because of not supported.

Since
API level 24
Constant Value: -3 (0xfffffffd)

public static final int ERROR_SIM_NOT_INSERTED

Since: API level 22

Flag to indicate that the specified SIM card is not inserted on the current device

Since
API level 22
MDM 5.8
Constant Value: 13 (0x0000000d)

public static final int ERROR_SIM_PIN_ALREADY_LOCKED

Since: API level 6

Flag to indicate that SIM PIN lock is already enabled but not by the administrator.

Since
API level 6
MDM 4.0
Constant Value: 4 (0x00000004)

public static final int ERROR_SIM_PIN_ALREADY_LOCKED_BY_ADMIN

Since: API level 6

Flag to indicate that SIM PIN lock is already enabled by the current administrator.

Since
API level 6
MDM 4.0
Constant Value: 11 (0x0000000b)

public static final int ERROR_SIM_PIN_ALREADY_UNLOCKED

Since: API level 6

Flag to indicate that SIM PIN lock is already disabled.

Since
API level 6
MDM 4.0
Constant Value: 5 (0x00000005)

public static final int ERROR_SIM_PIN_BLOCKED_BY_PUK

Since: API level 6

Flag to indicate that SIM card is locked by a PIN unlock key (PUK). In this situation no SIM PIN operation can be executed. The SIM card must be unlocked with the PUK to allow SIM PIN operations.

Since
API level 6
MDM 4.0
Constant Value: 6 (0x00000006)

public static final int ERROR_SIM_PIN_DATABASE

Since: API level 6

Flag to indicate a database error occurred.

Since
API level 6
MDM 4.0
Constant Value: 10 (0x0000000a)

public static final int ERROR_SIM_PIN_FAILED

Since: API level 6

Flag to indicate that a SIM PIN operation failed with a generic error.

Since
API level 6
MDM 4.0
Constant Value: 1 (0x00000001)

public static final int ERROR_SIM_PIN_ID_NOT_READY

Since: API level 6

Flag to indicate that the SIM card is not ready yet. For example, SIM card operations cannot be executed when airplane mode is on.

Since
API level 6
MDM 4.0
Constant Value: 9 (0x00000009)

public static final int ERROR_SIM_PIN_INCORRECT_CODE

Since: API level 6

Flag to indicate that a wrong SIM PIN value was supplied.

Since
API level 6
MDM 4.0
Constant Value: 3 (0x00000003)

public static final int ERROR_SIM_PIN_INVALID_CODE

Since: API level 6

Flag to indicate that an invalid SIM PIN value was supplied. A PIN code is a numeric value containing 4 to 8 digits.

Since
API level 6
MDM 4.0
Constant Value: 2 (0x00000002)

public static final int ERROR_SIM_PIN_MAX_RETRIES_EXCEEDED

Since: API level 6

Flag to indicate that the maximum number of SIM PIN operations attempts with the wrong PIN code has been reached. A SIM card usually allows three attempts before blocking itself by PUK. However, to avoid PUK blocking, no SIM PIN operation is executed while the number of remaining attempts is 1 or less.

Since
API level 6
MDM 4.0
Constant Value: 8 (0x00000008)

public static final int ERROR_SIM_PIN_NONE

Since: API level 6

Flag to indicate that a subscriber identiy module (SIM) personal identification number (PIN) operation completed successfully.

Since
API level 6
MDM 4.0
Constant Value: 0 (0x00000000)

public static final int ERROR_SIM_PIN_OWNED_BY_OTHER_ADMIN

Since: API level 6

Flag to indicate that another administrator has already locked the SIM card on the current device.

Since
API level 6
MDM 4.0
Constant Value: 12 (0x0000000c)

public static final int ERROR_SIM_PIN_UNKNOWN

Since: API level 6

Flag to indicate that an unknown error occurred.

Since
API level 6
MDM 4.0
Constant Value: 100 (0x00000064)

public static final int ERROR_UNKNOWN

Since: API level 24

Flag to indicate that API failed for an unknown reason

Since
API level 24
Constant Value: -2 (0xfffffffe)

public static final String FILE_PATH

Since: API level 26

This constant is a key to fetch file path of RCS message from Bundle returned by getRCSMessage(long). Applicable only in RCS message of type file.

Since
API level 26
KNOX 3.2
Constant Value: "file-path"

public static final int LIMIT_NUMBER_OF_CALLS_BY_DAY

Since: API level 2

Flag to be used to retrieve the number of incoming or outgoing calls allowed by day.

Since
API level 2
MDM 2.0
Constant Value: 0 (0x00000000)

public static final int LIMIT_NUMBER_OF_CALLS_BY_MONTH

Since: API level 2

Flag to be used to retrieve the number of incoming or outgoing calls allowed by month.

Since
API level 2
MDM 2.0
Constant Value: 2 (0x00000002)

public static final int LIMIT_NUMBER_OF_CALLS_BY_WEEK

Since: API level 2

Flag to be used to retrieve the number of incoming or outgoing calls allowed by week.

Since
API level 2
MDM 2.0
Constant Value: 1 (0x00000001)

public static final int LIMIT_NUMBER_OF_DATA_CALLS_BY_DAY

Since: API level 2

Flag to be used to retrieve the amount of data packets sent or received allowed by day.

Since
API level 2
MDM 2.0
Constant Value: 0 (0x00000000)

public static final int LIMIT_NUMBER_OF_DATA_CALLS_BY_MONTH

Since: API level 2

Flag to be used to retrieve the amount of data packets sent or received allowed by month.

Since
API level 2
MDM 2.0
Constant Value: 2 (0x00000002)

public static final int LIMIT_NUMBER_OF_DATA_CALLS_BY_WEEK

Since: API level 2

Flag to be used to retrieve the amount of data packets sent or received allowed by week.

Since
API level 2
MDM 2.0
Constant Value: 1 (0x00000001)

public static final int LIMIT_NUMBER_OF_SMS_BY_DAY

Since: API level 2

Flag to be used to retrieve the number of sent or received Short Message Service (SMS) text messages allowed by day.

Since
API level 2
MDM 2.0
Constant Value: 0 (0x00000000)

public static final int LIMIT_NUMBER_OF_SMS_BY_MONTH

Since: API level 2

Flag to be used to retrieve the number of sent or received Short Message Service (SMS) text messages allowed by month.

Since
API level 2
MDM 2.0
Constant Value: 2 (0x00000002)

public static final int LIMIT_NUMBER_OF_SMS_BY_WEEK

Since: API level 2

Flag to be used to retrieve the number of sent or received Short Message Service (SMS) text messages allowed by week.

Since
API level 2
MDM 2.0
Constant Value: 1 (0x00000001)

public static final int RCS_FEATURE_ALL

Since: API level 24

Flag to indicate that all RCS feature which contains call and message.

Since
API level 24
Constant Value: 1 (0x00000001)

public static final String REMOTE_URI

Since: API level 26

Used as an String extra field with the return value of getRCSMessage(long). Contains the sender's address.

Since
API level 26
KNOX 3.2
Constant Value: "remote-uri"

public static final String SENDER_ALIAS

Since: API level 26

This constant is a key to fetch sender's alias of RCS message from Bundle returned by getRCSMessage(long).

Since
API level 26
KNOX 3.2
Constant Value: "sender-alias"

public static final String THUMBNAIL_PATH

Since: API level 26

This constant is a key to fetch thumbnail path of RCS message from Bundle returned by getRCSMessage(long). Applicable only in RCS message of type file.

Since
API level 26
KNOX 3.2
Constant Value: "thumbnail-path"

public static final String TIMESTAMP

Since: API level 26

This constant is a key to fetch RCS message's received or sent timestamp from Bundle returned by getRCSMessage(long).

Since
API level 26
KNOX 3.2
Constant Value: "timestamp"

Public Methods

public boolean addIncomingCallExceptionPattern (String pattern)

Since: API level 11

API to add an exception pattern to the administrator's exception pattern set for incoming calls.

Parameters
pattern The exception pattern to be added to administrator's exception pattern set.
Returns
  • true if adding incoming call exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
This API adds (concatenates) the provided exception pattern to the exception pattern set of the administrator for incoming calls. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has not priority over restriction pattern set by other administrator. Previous patterns remain and the new pattern is added. The API returns false if the device has no voice call capability (e.g., tablets).

See setOutgoingCallExceptionPattern(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // previous patterns remain and the new pattern is added
     // to allow incoming calls
     if (phoneRestrictionPolicy.addIncomingCallExceptionPattern(".*")) {
         Log.d(TAG, "success adding incoming call exception pattern");
     } else {
         Log.w(TAG, "failed adding incoming call exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean addIncomingCallRestriction (String pattern)

Since: API level 2

API to add a restriction pattern to the administrator's restriction pattern set for incoming calls.

Parameters
pattern The restriction pattern to be added to administrator's restriction pattern set.
Returns
  • true if adding incoming call restriction is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This API adds (concatenates) the provided restriction pattern to the restriction pattern set of the administrator for incoming calls. The API returns false if the device has no voice call capability (e.g., a tablet).

See setOutgoingCallRestriction(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // previous patterns remain and the new pattern is added
     // to block incoming calls
     if (phoneRestrictionPolicy.addIncomingCallRestriction(".*")) {
         Log.d(TAG, "success adding incoming call restriction");
     } else {
         Log.w(TAG, "failed adding incoming call restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean addIncomingSmsExceptionPattern (String pattern)

Since: API level 11

API to add an exception pattern to the administrator's exception pattern set for incoming SMSs.

Parameters
pattern The exception pattern to be added to the administrator's exception pattern set.
Returns
  • true if adding incoming sms exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
This API adds (concatenates) the provided exception pattern to the exception pattern set of the administrator for incoming SMSs. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has not priority over restriction pattern set by other administrator. Previous patterns remain and the new pattern is added. The API returns false if the device has no voice call capability (e.g., tablets).

See setOutgoingSmsExceptionPattern(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // previous patterns remain and the new pattern is added
     // to allow incoming SMSs
     if (phoneRestrictionPolicy.addIncomingSmsExceptionPattern(".*")) {
         Log.d(TAG, "success adding incoming sms exception pattern");
     } else {
         Log.w(TAG, "failed adding incoming sms exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean addIncomingSmsRestriction (String pattern)

Since: API level 2

API to add a restriction pattern to the administrator restriction pattern set for incoming Short Message Service (SMS) text messages.

Parameters
pattern The restriction pattern.
Returns
  • true if adding incoming SMS restriction is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method adds the provided pattern to the pattern set from the calling administrator if it exists or sets the pattern if none exist.

See setOutgoingCallRestriction(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // previous patterns remain and the new pattern is added
     // to block incoming SMS
     if (phoneRestrictionPolicy.addIncomingSmsRestriction(".*")) {
         Log.d(TAG, "success adding incoming SMS restriction");
     } else {
         Log.w(TAG, "failed adding incoming SMS restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean addOutgoingCallExceptionPattern (String pattern)

Since: API level 11

API to add an exception pattern to the administrator's exception pattern set for outgoing calls.

Parameters
pattern The exception pattern to be added to the administrator's exception pattern set.
Returns
  • true if adding outgoing call exception pattern was successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
This API adds (concatenates) the provided exception pattern to the exception pattern set of the administrator for outgoing calls. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has not priority over restriction pattern set by other administrator. Previous patterns remain and the new pattern is added. The API returns false if the device has no voice call capability (e.g., tablets).

See setOutgoingCallExceptionPattern(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // previous patterns remain and the new pattern is added
     // to allow outgoing calls
     if (phoneRestrictionPolicy.addOutgoingCallExceptionPattern(".*")) {
         Log.d(TAG, "success adding outgoing call exception pattern");
     } else {
         Log.w(TAG, "failed adding outgoing call exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean addOutgoingCallRestriction (String pattern)

Since: API level 2

API to add a restriction pattern to the administrator's restriction pattern set for outgoing calls.

Parameters
pattern The restriction pattern to be added to the administrator's restriction pattern set.
Returns
  • true if adding outgoing call restriction was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This API adds (concatenates) the provided restriction pattern to the restriction pattern set of the administrator for outgoing calls. Previous patterns remain and the new pattern is added. The API returns false if the device has no voice call capability (e.g., a tablet).

See setOutgoingCallRestriction(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // previous patterns remain and the new pattern is added
     // to block outgoing calls
     if (phoneRestrictionPolicy.addOutgoingCallRestriction(".*")) {
         Log.d(TAG, "success adding outgoing call restriction");
     } else {
         Log.w(TAG, "failed adding outgoing call restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean addOutgoingSmsExceptionPattern (String pattern)

Since: API level 11

API to add an exception pattern to the administrator's exception pattern set for outgoing SMSs.

Parameters
pattern The exception pattern to be added to the administrator's exception pattern set.
Returns
  • true if adding outgoing sms exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
This API adds (concatenates) the provided exception pattern to the exception pattern set of the administrator for outgoing SMSs. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has not priority over restriction pattern set by other administrator. Previous patterns remain and the new pattern is added. The API returns false if the device has no voice call capability (e.g., tablets).

See setOutgoingSmsExceptionPattern(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // previous patterns remain and the new pattern is added
     // to allow outgoing SMSs
     if (phoneRestrictionPolicy.addOutgoingSmsExceptionPattern(".*")) {
         Log.d(TAG, "success adding outgoing sms exception pattern");
     } else {
         Log.w(TAG, "failed adding outgoing sms exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean addOutgoingSmsRestriction (String pattern)

Since: API level 2

API to add a restriction pattern to the administrator restriction pattern set for outgoing Short Message Service (SMS) text messages.

Parameters
pattern The restriction pattern.
Returns
  • true if adding outgoing SMS restriction is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method adds the provided pattern to the pattern set from the calling administrator (if it exists) or sets the pattern if none exist. Previous patterns remain and the new pattern is added.

See setOutgoingCallRestriction(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // previous patterns remain and the new pattern is added
     // blocking all outgoing SMS
     if (phoneRestrictionPolicy.addOutgoingSmsRestriction(".*")) {
         Log.d(TAG, "success adding outgoing SMS restriction");
     } else {
         Log.w(TAG, "failed adding outgoing SMS restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean allowCallerIDDisplay (boolean allow)

Since: API level 6

API to allow or disallow caller Id display during an incoming call.

Parameters
allow true to allow caller Id display, false to prevent displaying caller Id.
Returns
  • true when successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to allow or disallow caller Id information on the device during an incoming call.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean allowCopyContactToSim (boolean allow)

Since: API level 11

API to enable / disable Copy contact from device to SIM Card.

Parameters
allow true to enable, else false
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
Administrator can use this API to disable copy from a contact stored at device to SIM card phonebook. If this is disallowed, user will not be able to copy, edit or add contacts to SIM Card phonebook.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();
 try {
     boolean enableCopyContactToSim = true;
     phoneRestrictionPolicy.allowCopyContactToSim(enableCopyContactToSim);
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 } 
Permission
The use of this API requires the caller to add the "com.samsung.android.knox.permission.KNOX_PHONE_RESTRICTION" permission with a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean allowIncomingMms (boolean allow)

Since: API level 5

Deprecated in API level 35

API to allow or disallow incoming Multimedia Messaging Service (MMS) messages.

Parameters
allow true to allow incoming MMS messages, false to disallow incoming MMS messages.
Returns
  • true if setting allow/disallow incoming MMS was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to allow or disallow incoming MMS messages.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.allowIncomingMms(false)) {
         Log.d(TAG, "Incoming MMS blocked successfully");
     } else {
         Log.d(TAG, "Failed to block incoming MMS");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

NOTE: This API is strongly coupled to the native MMS client application. So, if user defines a third-party application as default for messaging, this policy may not apply. It's recommended to prevent the user from installing other messaging applications by using ApplicationPolicy APIs (like addAppPackageNameToBlackList(String) and addPackagesToPreventStartBlackList(List)).

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

public boolean allowIncomingSms (boolean allow)

Since: API level 5

Deprecated in API level 35

API to allow or disallow incoming Short Message Service (SMS) text messages.

Parameters
allow true to allow incoming SMS messages, false to disallow incoming SMS messages.
Returns
  • true if allowing/disallowing incoming SMS messages was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to allow or disallow incoming SMS messages.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.allowIncomingSms(false)) {
         Log.d(TAG, "Incoming SMS blocked successfully");
     } else {
         Log.d(TAG, "Failed to block incoming SMS");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

NOTE: This policy will not apply in case native telephony stack is not used to receive SMS.

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

public boolean allowOutgoingMms (boolean allow)

Since: API level 5

Deprecated in API level 35

API to allow or disallow outgoing Multimedia Messaging Service (MMS) messages.

Parameters
allow true to allow outgoing MMS messages, false to disallow outgoing MMS messages.
Returns
  • true if setting allow/disallow outgoing MMS was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to allow or disallow outgoing MMS messages.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.allowOutgoingMms(false)) {
         Log.d(TAG, "Outgoing MMS blocked successfuly");
     } else {
         Log.d(TAG, "Failed to block outgoing MMS");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

NOTE: This API is strongly coupled to the native MMS client application. So, if user defines a third-party application as default for messaging, this policy may not apply. It's recommended to prevent the user from installing other messaging applications by using ApplicationPolicy APIs (like addAppPackageNameToBlackList(String) and addPackagesToPreventStartBlackList(List)).

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

public boolean allowOutgoingSms (boolean allow)

Since: API level 5

Deprecated in API level 35

API to allow or disallow outgoing Short Message Service (SMS) text messages.

Parameters
allow true to allow outgoing SMS messages, false to disallow outgoing SMS messages.
Returns
  • true if allowing/disallowing outgoing SMS messages was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to allow or disallow outgoing SMS messages.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.allowOutgoingSms(false)) {
         Log.d(TAG, "Outgoing SMS blocked successfully");
     } else {
         Log.d(TAG, "Failed to block outgoing SMS");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

NOTE: This policy will not apply in case native telephony stack is not used to send SMS.

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

public boolean allowWapPush (boolean allow)

Since: API level 6

Deprecated in API level 33

API to enable or disable processing of WAP Push messages.

Returns
  • true if allowing or disallowing WAP Push message processing was successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to enable or disable processing of WAP Push messages.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.allowWapPush(false)) {
         Log.d(TAG, "WAP push messages are disallowed.");
     } else {
         Log.d(TAG, "Failed to block WAP push");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean blockMmsWithStorage (boolean block)

Since: API level 6

API to allow or disallow storage of blocked incoming Multimedia Message Service (MMS) messages.

Parameters
block true to block incoming MMS messages and store them for late delivery, false to disable the blocking and deliver the MMS messages that were stored.
Returns
  • true if blocking/unblocking incoming MMS messages for late delivery was successful, false otherwise.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to block the user from receiving MMS messages. In addition, the messages are stored. When the administrator disable blocking, the MMS messages are delivered to the user. The following policies may restrict the usage of this policy: allowIncomingMms(boolean), setEmergencyCallOnly(boolean), allowWapPush(boolean) or setRoamingPush(boolean). If any of these policies block MMS messages, they are neither stored nor delivered to the user. The MMS messages are stored when this policy is the only reason to block the MMS messages.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.blockMmsWithStorage(true)) {
         Log.d(TAG, "MMS are blocked and stored for late delivery.");
     } else {
         Log.d(TAG, "Failed to enable blocking of MMS with storage for late delivery");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean blockSmsWithStorage (boolean block)

Since: API level 6

API to allow or disallow storage of blocked incoming Short Message Service (SMS) text messages.

Parameters
block true to block incoming SMS messages and store them for late delivery, false to disable blocking and deliver the SMS messages that were stored.
Returns
  • true if blocking/unblocking incoming SMS messages for late delivery was successful, false otherwise.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to block the user from receiving SMS messages but store the messages. When the administrator disables blocking, the SMS messages are delivered to the user. The following policies may restrict the usage of this policy: allowIncomingSms(boolean), setEmergencyCallOnly(boolean), setLimitOfIncomingSms(int, int, int) or setIncomingSmsRestriction(String). If any of these policies block SMS messages, they are neither stored nor delivered to the user. The SMS messages are stored when this policy is the only reason to block the SMS messages.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.blockSmsWithStorage(true)) {
         Log.d(TAG, "SMS will be blocked and stored for late delivery.");
     } else {
         Log.d(TAG, "Failed to enable blocking of SMS, with storage for late delivery");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean canIncomingCall (String dialNumber)

Since: API level 2

API to check if a given dial number for incoming call matches the incoming call restriction pattern.

Parameters
dialNumber The dial number of the incoming call.
Returns
  • true if the dial number matches the pattern, false if the dial number does not match.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean canIncomingSms (String phoneNumber)

Since: API level 2

API to check whether an incoming Short Message Service (SMS) text message from a given number is allowed.

Parameters
phoneNumber The phone number to be checked.
Returns
  • true if the phone number for the incoming SMS is allowed, false if the phone number for the incoming SMS is not allowed.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean canOutgoingCall (String dialNumber)

Since: API level 2

API to check if a given dial number for an outgoing call matches the outgoing call restriction pattern.

Parameters
dialNumber The dial number of the outgoing call.
Returns
  • true if the dial number matches the pattern, false if the dial number does not match.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean canOutgoingSms (String phoneNumber)

Since: API level 2

API to check whether an outgoing Short Message Service (SMS) text message to a given number is allowed.

Parameters
phoneNumber The phone number to be checked.
Returns
  • true if the phone number for the outgoing SMS is allowed, false if the phone number for the outgoing SMS is not allowed.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public int changeSimPinCode (String currentPinCode, String newPinCode)

Since: API level 6

API to change SIM card's PIN code.

Parameters
currentPinCode current SIM card's PIN code value
newPinCode new PIN code value to be set
Returns
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to change a SIM card's PIN code. As a requirement, PIN lock must be enabled, otherwise ERROR_SIM_PIN_ALREADY_UNLOCKED is returned.
The administrator must provide the current PIN code and the new desired value. Both are numeric codes with 4 to 8 digits. If any of provided PIN codes is in an unexpected format, ERROR_SIM_PIN_INVALID_CODE is returned. If the current PIN code is incorrect, ERROR_SIM_PIN_INCORRECT_CODE is returned and one attempt is wasted. If there is one or less remaining attempt, ERROR_SIM_PIN_MAX_RETRIES_EXCEEDED is returned.
The administrator can change the PIN code of any SIM card unless it is locked by another administrator on the same device; in this case, ERROR_SIM_PIN_OWNED_BY_OTHER_ADMIN is returned. When a SIM card's PIN code is changed, the current administrator becomes the owner on that device.
The SIM card does not operate when the device is in Offline (airplane) Mode. In this case, ERROR_SIM_PIN_ID_NOT_READY is returned, which indicated that the SIM card is not ready for operations.


NOTE: Since MDM 5.8 administrator can specify the iccId of the SIM card that will be affected for this policy using getPhoneRestrictionPolicy(String)

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();
 // This will get the phoneRestrictionPolicy for the default SIM.
 PhoneRestrictionPolicy phoneRestrictionPolicyForDefault = edm.getPhoneRestrictionPolicy();
 String oldPinCodeForDefaultSIM = "1234"
 String newPinCodeForDefaultSIM = "8888"

 // Subscription Manager to get SIM information
 SubscriptionManager subManager = (SubscriptionManager) getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
 // Get the iccId for the device inserted on Slot 0
 String iccId = subManager.getActiveSubscriptionInfoForSimSlotIndex(0).getIccId();
 // This will get the phoneRestrictionPolicy for a specific SIM Card with the given ICCID.
 PhoneRestrictionPolicy phoneRestrictionPolicyForSpecificSIM = edm.getPhoneRestrictionPolicy(iccId);
 String oldPinCodeForSpecificSIM = "5678"
 String newPinCodeForSpecificSIM = "9999"
 try {
     // Change SIM Pin for Default SIM
     int resultForDefaultSim = phoneRestrictionPolicyForDefault.changeSimPinCode(oldPinCodeForDefaultSIM,newPinCodeForDefaultSIM);
     checkResult(resultForDefaultSim);

     // Change the SIM Pin for a specific SIM
     int resultForSpecificSIm = phoneRestrictionPolicyForSpecificSIM.changeSimPinCode(oldPinCodeForSpecificSIM,newPinCodeForSpecificSIM);
     checkResult(resultForSpecificSIm);
 } catch (SecurityException securityException) {
     Log.w(TAG, "SecurityException: " + securityException);
 }

 private void checkResult(int result) {
      switch (result) {
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_NONE:
              Log.d(TAG, "SIM PIN code successfully changed");
              break;
          case PhoneRestrictionPolicy.ERROR_SIM_PIN_ALREADY_LOCKED:
             Log.d(TAG, "Failed: Already locked but not by administrator");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_ALREADY_UNLOCKED:
         Log.d(TAG, "Failed: Cannot change PIN code when
                 PIN lock is disabled");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_BLOCKED_BY_PUK:
         Log.d(TAG, "Failed: SIM card is blocked by PIN unlock key (PUK)");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_DATABASE:
         Log.d(TAG, "Failed to enable SIM PIN lock: a database error
                 occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_UNKNOWN:
         Log.d(TAG, "Failed: Unknown error occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_FAILED:
         Log.d(TAG, "Failed: Generic error occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_ID_NOT_READY:
         Log.d(TAG, "Failed: SIM card is not ready yet");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_INCORRECT_CODE:
         Log.d(TAG, "Failed: Supplied PIN code is wrong");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_INVALID_CODE:
         Log.d(TAG, "Failed: Supplied PIN code is in wrong format");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_MAX_RETRIES_EXCEEDED:
         Log.d(TAG, "Failed: Maximum number of retries reached");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_OWNED_BY_OTHER_ADMIN:
              Log.d(TAG,
              "Failed: Operation denied. Another administrator has already locked this SIM card on this device");
              break;
          case PhoneRestrictionPolicy.ERROR_SIM_NOT_INSERTED:
              Log.d(TAG,
              "Failed: The specified Sim Card is not present");
         break;
     }
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean clearStoredBlockedMms ()

Since: API level 6

API that clears all stored, blocked Multimedia Message Service (MMS) messages.

Returns
  • true if stored MMS messages were cleared successfully, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to clear blocked MMS messages that were stored.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.clearStoredBlockedMms()) {
         Log.d(TAG, "Stored MMS were cleared.");
     } else {
         Log.d(TAG, "Failed to clear stored MMS");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean clearStoredBlockedSms ()

Since: API level 6

API that clears all stored, blocked Short Message Service (SMS) text messages.

Returns
  • true if stored SMS messages were cleared successfully, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to clear blocked SMS messages that were stored.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.clearStoredBlockedSms()) {
         Log.d(TAG, "Stored SMS were cleared.");
     } else {
         Log.d(TAG, "Failed to clear stored SMS");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public int disableSimPinLock (String pinCode)

Since: API level 6

API to disable SIM card's PIN lock. User is able to use SIM card on other devices and no PIN code is required.

Parameters
pinCode current SIM card's PIN code value
Returns
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to disable the SIM card's PIN lock. The user can use the SIM card on any device without requiring a PIN code.
To disable the SIM PIN lock, the administrator must provide the current PIN code, which is a numeric code of 4 to 8 digits. If the PIN code is provided in an unexpected format, ERROR_SIM_PIN_INVALID_CODE is returned. If the PIN code is incorrect, ERROR_SIM_PIN_INCORRECT_CODE is returned and one attempt is wasted. If one or less attempt remains, ERROR_SIM_PIN_MAX_RETRIES_EXCEEDED is returned.
The administrator can disable the PIN lock on any SIM card unless it is locked by other administrator on the same device; in this case, ERROR_SIM_PIN_OWNED_BY_OTHER_ADMIN is returned. When a SIM card's PIN lock is disabled, the SIM card no longer owned by any administrator until its PIN lock is enabled again on that device.
It is not possible to run SIM card operations when device is offline (airplane) Mode. In this case, ERROR_SIM_PIN_ID_NOT_READY is returned, which indicates that the SIM card is not ready for operations.


NOTE: Since MDM 5.8 administrator can specify the iccId of the SIM card that will be affected by this policy using getPhoneRestrictionPolicy(String)

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 // This will get the phoneRestrictionPolicy for the default SIM.
 PhoneRestrictionPolicy phoneRestrictionPolicyForDefault = edm.getPhoneRestrictionPolicy();
 String pinCodeForDefault = "1234"

 // Subscription Manager to get SIM information
 SubscriptionManager subManager = (SubscriptionManager) getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
 // Get the iccId for the device inserted on Slot 0
 String iccId = subManager.getActiveSubscriptionInfoForSimSlotIndex(0).getIccId();
 // This will get the phoneRestrictionPolicy for a specific SIM Card with the given ICCID.
 PhoneRestrictionPolicy phoneRestrictionPolicyForSpecificSIM = edm.getPhoneRestrictionPolicy(iccId);
 String pinCodeForSpecificSIM = "5678"

 try {
     // Disable the SIM Pin Lock for Default SIM
     int resultForDefaultSim = phoneRestrictionPolicyForDefault.disableSimPinLock(pinCodeForDefault);
     checkResult(resultForDefaultSim);

     // Disable the SIM Pin Lock for a specific SIM
     int resultForSpecificSIm = phoneRestrictionPolicyForSpecificSIM.disableSimPinLock(pinCodeForSpecificSIM);
     checkResult(resultForSpecificSIm);
 } catch (SecurityException securityException) {
     Log.w(TAG, "SecurityException: " + securityException);
 }

 private void checkResult(int result) {
      switch (result) {
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_NONE:
         Log.d(TAG, "SIM PIN lock successfully disabled");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_ALREADY_UNLOCKED:
         Log.d(TAG, "Failed: Already unlocked");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_BLOCKED_BY_PUK:
         Log.d(TAG, "Failed: SIM card is blocked by PIN unlock key (PUK)");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_DATABASE:
         Log.d(TAG, "Failed to enable SIM PIN lock: a database error
                 occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_UNKNOWN:
         Log.d(TAG, "Failed: Unknown error occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_FAILED:
         Log.d(TAG, "F boolean isCopyContactToSimAllowed(ailed: Generic error occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_ID_NOT_READY:
         Log.d(TAG, "Failed: SIM card is not ready yet");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_INCORRECT_CODE:
         Log.d(TAG, "Failed: Supplied PIN code is wrong");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_INVALID_CODE:
         Log.d(TAG, "Failed: Supplied PIN code is in wrong format");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_MAX_RETRIES_EXCEEDED:
         Log.d(TAG, "Failed: Maximum number of retries reached");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_OWNED_BY_OTHER_ADMIN:
         Log.d(TAG, "Failed: Operation denied. Another administrator has locked
                 this SIM card on this device");
         break;
          case PhoneRestrictionPolicy.ERROR_SIM_NOT_INSERTED:
              Log.d(TAG,
              "Failed: The specified Sim Card is not present");
         break;
     }
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean enableLimitNumberOfCalls (boolean status)

Since: API level 2

API to enable or disable limiting the number of calls.

Parameters
status true to enable limiting the number of calls , false to disable limiting the number of calls.
Returns
  • true if enabling limits to number of calls is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this policy to enable or disable limiting the number of calls allowed on the device. This policy is complemented by setLimitOfIncomingCalls(int, int, int) and setLimitOfOutgoingCalls(int, int, int).

The API returns false if the device has no voice call capability (e.g., a tablet). This policy is controlled by the last administrator who called it. For a device managed by multiple administrators, the last limit values set are the values used to restrict the user. This measure also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.enableLimitNumberOfCalls(true)) {
         // Set the incoming call limit to 5 by day, no limit by week, 100 by
         // month
         if (phoneRestrictionPolicy.setLimitOfIncomingCalls(5, 0, 100)) {
             Log.d(TAG, "success setting incoming call limits");
         } else {
             Log.w(TAG, "failure setting incoming call limits");
         }
         // Set the outgoing call limit to 10 by day, no limit by week, no limit
         // by month
         if (phoneRestrictionPolicy.setLimitOfOutgoingCalls(10, 0, 0)) {
             Log.d(TAG, "success setting outgoing call limits");
         } else {
             Log.w(TAG, "failure setting outgoing call limits");
         }
     } else {
         Log.w(TAG, "failure enabling call limits");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean enableLimitNumberOfSms (boolean status)

Since: API level 2

API to enable or disable limiting the number of Short Message Service (SMS) text messages.

Parameters
status true to enable, false to disable.
Returns
  • true if enabling limits on the number of SMS messages was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to enable or disable limiting the number of SMS messages allowed on the device. This policy is complemented by setLimitOfIncomingSms(int, int, int) and setLimitOfOutgoingSms(int, int, int).

For a device managed by multiple administrators, the last limit values set apply. This measure also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.enableLimitNumberOfSms(true)) {
         // Set the incoming SMS limit to 10 by day, no limit by week, no limit
         // by month
         if (phoneRestrictionPolicy.setLimitOfIncomingSms(10, 0, 0)) {
             Log.d(TAG, "success setting incoming SMS limits");
         } else {
             Log.w(TAG, "failure setting incoming SMS limits");
         }
         // Set the outgoing SMS limit to 5 by day, 20 by week, 100 by month
         if (phoneRestrictionPolicy.setLimitOfOutgoingSms(5, 20, 100)) {
             Log.d(TAG, "success setting outgoing SMS limits");
         } else {
             Log.w(TAG, "failure setting outgoing SMS limits");
         }
     } else {
         Log.w(TAG, "failure enabling SMS limits");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public int enableSimPinLock (String pinCode)

Since: API level 6

API to enable SIM card's PIN lock. The user is prevented from using the SIM card in other devices since a PIN code is required to use the SIM.

Parameters
pinCode current SIM card's PIN code value
Returns
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to enable the SIM card's PIN lock. The lock is transparent to the user: Whenever the device is powered on, it automatically unlocks the SIM card for that session. However, if the SIM card is moved to another device, it remains locked.
To enable the SIM card PIN lock, an administrator must provide the current PIN code, which is a numeric code of 4 to 8 digits. If the provided PIN code is not in the expected format, ERROR_SIM_PIN_INVALID_CODE is returned. Also, if the code is incorrect, ERROR_SIM_PIN_INCORRECT_CODE is returned and one attempt is wasted. If one (or less) potential attempt remains, ERROR_SIM_PIN_MAX_RETRIES_EXCEEDED is returned.
The administrator is allowed to enable PIN lock on any SIM card unless it is already enabled. When a SIM card's PIN lock is enabled successfully, the current administrator becomes the owner on that device.
It is not possible to run SIM card operations when device is offline (airplane mode). In this case, ERROR_SIM_PIN_ID_NOT_READY is returned, indicating that the SIM card is not ready for operations.
NOTE: Since MDM 5.8 administrator can specify the iccId of the SIM card that will be affected by this policy using getPhoneRestrictionPolicy(String)

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 // This will get the phoneRestrictionPolicy for the default SIM.
 PhoneRestrictionPolicy phoneRestrictionPolicyForDefault = edm.getPhoneRestrictionPolicy();
 String pinCodeForDefault = "1234"

 // Subscription Manager to get SIM information
 SubscriptionManager subManager = (SubscriptionManager) getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
 // Get the iccId for the device inserted on Slot 0
 String iccId = subManager.getActiveSubscriptionInfoForSimSlotIndex(0).getIccId();
 // This will get the phoneRestrictionPolicy for a specific SIM Card with the given ICCID.
 PhoneRestrictionPolicy phoneRestrictionPolicyForSpecificSIM = edm.getPhoneRestrictionPolicy(iccId);
 String pinCodeForSpecificSIM = "5678"

 try {
     // Enable the SIM Pin for Default SIM
     int resultForDefaultSim = phoneRestrictionPolicyForDefault.enableSimPinLock(pinCodeForDefault);
     checkResult(resultForDefaultSim);

     // Enable the SIM Pin for a specific SIM
     int resultForSpecificSIm = phoneRestrictionPolicyForSpecificSIM.enableSimPinLock(pinCodeForSpecificSIM);
     checkResult(resultForSpecificSIm);
 } catch (SecurityException securityException) {
     Log.w(TAG, "SecurityException: " + securityException);
 }

 private void checkResult(int result) {
      switch (result) {
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_NONE:
         Log.d(TAG, "SIM PIN lock successfully enabled");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_ALREADY_LOCKED:
         Log.d(TAG, "Failed: Already locked but not by administrator");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_ALREADY_LOCKED_BY_ADMIN:
         Log.d(TAG, "Failed: Already locked by current administrator");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_BLOCKED_BY_PUK:
         Log.d(TAG, "Failed: SIM card is blocked by PIN unlock key (PUK)");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_DATABASE:
         Log.d(TAG, "Failed to enable SIM PIN lock: a database error
                 occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_UNKNOWN:
         Log.d(TAG, "Failed: Unknown error occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_FAILED:
         Log.d(TAG, "Failed: Generic error occurred");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_ID_NOT_READY:
         Log.d(TAG, "Failed: SIM card is not ready yet");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_INCORRECT_CODE:
         Log.d(TAG, "Failed: Supplied PIN code is wrong");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_INVALID_CODE:
         Log.d(TAG, "Failed: Supplied PIN code is in wrong format");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_MAX_RETRIES_EXCEEDED:
         Log.d(TAG, "Failed: Maximum number of retries reached");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_PIN_OWNED_BY_OTHER_ADMIN:
         Log.d(TAG, "Failed: Operation denied. Another administrator has already
                 locked this SIM card on this device");
         break;
     case PhoneRestrictionPolicy.ERROR_SIM_NOT_INSERTED:
         Log.d(TAG, "Failed: The specified Sim Card is not present");
         break;
     }
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean getDataCallLimitEnabled ()

Since: API level 2

API to check whether a limit on carrier data network usage is enabled.

Returns
  • true if the device is currently limiting the amount of bytes to be sent and received through the carrier's data network. false if the device is not currently limiting the amount of bytes to be sent and received through carrier's data network.
Usage
An administrator can use this interface to verify if a limit on data carrier network usage is currently enabled on the device.

For a device managed by multiple administrators, this method returns the more restricted value rather than the value set by the calling administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 if (phoneRestrictionPolicy.getDataCallLimitEnabled()) {
     Log.d(TAG, "Data call limit enabled");
 } else {
     Log.w(TAG, "Data call limit disabled");
 }
 
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public String getDisclaimerText ()

Since: API level 29

Deprecated in API level 35

API to get a disclaimer text for outgoing sms and mms.

@hide_knox

Returns
  • String Disclaimer text
Usage
This API will return a disclaimer text set by administrator for outgoing sms and mms

 EnterpriseDeviceManager edm = (EnterpriseDeviceManager)
      getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();
 
 try {
     // get a new disclaimer text
     String result = phoneRestrictionPolicy.getDisclaimerText() {
     if (result == null) {
         // this policy not set by any admin
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 21
MDM 5.7.1
Multiuser Environment
Global Scope

public boolean getEmergencyCallOnly (boolean allAdmins)

Since: API level 2

API to check whether emergency calls only are allowed on the device.

Parameters
allAdmins true to get restricted value from all administrators, false to get restricted value only from the calling administrator.
Returns
  • true if only emergency calls are allowed, false otherwise.
Usage
An administrator can use this API to check emergency calls only are enabled on the device. If enabled, all other calls are blocked. The API returns false if the device has no voice call capability (e.g., a tablet).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.getEmergencyCallOnly(true)) { // true to get
                                                              // restricted value
                                                              // from all administrators
         Log.d(TAG, "blocking all calls except emergency");
     } else {
         Log.d(TAG, "not blocking all calls");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }

 
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public String getIncomingCallExceptionPatterns ()

Since: API level 11

API to get the exception pattern for incoming calls.

Returns
  • The concatenated exception pattern for incoming calls if successful, else null.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to retrieve the current pattern used as exception/whitelist for incoming calls. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator. The API returns null if the device has no voice call capability (e.g., tablets).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // get the concatenated exception pattern from the all administrators
     String incomingCallsPattern = phoneRestrictionPolicy.getIncomingCallExceptionPatterns();
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public String getIncomingCallRestriction (boolean allAdmins)

Since: API level 2

API to get the restriction pattern for incoming calls.

Parameters
allAdmins If true, get a composition of all restrictions from all administrators. If false, get a restriction pattern from the calling administrator only.
Returns
  • The restriction pattern for incoming calls if successful, else null.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to retrieve the current pattern used to restrict incoming calls. The API returns null if the device has no voice call capability (e.g., a tablet).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // get the restriction pattern from the calling administrator (using parameter
     // false)
     String incomingCallsPattern = phoneRestrictionPolicy.getIncomingCallRestriction(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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public String getIncomingSmsExceptionPatterns ()

Since: API level 11

API to get the exception pattern for incoming SMSs.

Returns
  • The concatenated exception pattern for incoming SMSs if successful, else null.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to retrieve the current pattern used as exception/whitelist for incoming SMSs. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator. The API returns null if the device has no voice call capability (e.g., tablets).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // get the concatenated exception pattern from the all administrators
     String incomingSMSsPattern = phoneRestrictionPolicy.getIncomingSmsExceptionPatterns();
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public String getIncomingSmsRestriction (boolean allAdmins)

Since: API level 2

API to get the restriction pattern for incoming Short Message Service (SMS) text messages.

Parameters
allAdmins true if restriction pattern from all administrators must be returned, false for the pattern from the calling administrator.
Returns
  • The pattern combination for incoming SMS restriction, or null if no combination for incoming SMS restriction is set.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
If the specified parameter is false, this method returns the incoming SMS restriction pattern for the calling administrator. If the parameter is true, this method returns a combination of all pattern sets by all administrators.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // get the incoming SMS restriction pattern from the calling administrator (using parameter
     // false)
     String incomingSmsPattern = phoneRestrictionPolicy.getIncomingSmsRestriction(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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public long getLimitOfDataCalls (int type)

Since: API level 2

API to get the limits on data packet usage per day, week, or month.

Returns
  • The limit on data packet byte usage if successful, else -1.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to determine the limit in data network usage per day, week, or month.

For a device managed by multiple administrators, this method returns the more restricted value rather than the value set by the calling administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 if (phoneRestrictionPolicy.getDataCallLimitEnabled()) {
     int currentDataCallsByDay = phoneRestrictionPolicy
             .getLimitOfDataCalls(LIMIT_NUMBER_OF_DATA_CALLS_BY_DAY);
     int currentDataCallsByWeek = phoneRestrictionPolicy
             .getLimitOfDataCalls(LIMIT_NUMBER_OF_DATA_CALLS_BY_WEEK);
     int currentDataCallsByMonth = phoneRestrictionPolicy
             .getLimitOfDataCalls(LIMIT_NUMBER_OF_DATA_CALLS_BY_MONTH);
 }
 

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

public int getLimitOfIncomingCalls (int type)

Since: API level 2

API to get the limit of incoming calls for a day, week, or month.

Returns
  • The number of incoming calls allowed when successful, else -1.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method returns the restriction limit on the number of incoming calls based on the parameter passed to it. The API returns false if the device has no voice call capability (e.g., a tablet).

For a device managed by multiple administrators, the last limit values set apply. This measure also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 if (phoneRestrictionPolicy.isLimitNumberOfCallsEnabled()) {
     int currentIncomingCallsByDay = phoneRestrictionPolicy
             .getLimitOfIncomingCalls(LIMIT_NUMBER_OF_CALLS_BY_DAY);
     int currentIncomingCallsByWeek = phoneRestrictionPolicy
             .getLimitOfIncomingCalls(LIMIT_NUMBER_OF_CALLS_BY_WEEK);
     int currentIncomingCallsByMonth = phoneRestrictionPolicy
             .getLimitOfIncomingCalls(LIMIT_NUMBER_OF_CALLS_BY_MONTH);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public int getLimitOfIncomingSms (int type)

Since: API level 2

API to get the limit on incoming Short Message Service (SMS) text messages for a day, week, or month.

Parameters
type Must be one of the following values:

LIMIT_NUMBER_OF_SMS_BY_DAY
LIMIT_NUMBER_OF_SMS_BY_WEEK
LIMIT_NUMBER_OF_SMS_BY_MONTH

Returns
  • The number of incoming SMS messages allowed for the specified period when successful, else -1.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method returns the restriction limit set on the number of incoming SMS messages based on the parameter passed to it.

For a device managed by multiple administrators, the last limit values set apply. This setting also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 if (phoneRestrictionPolicy.isLimitNumberOfSmsEnabled()) {
     int currentIncomingSmsByDay = phoneRestrictionPolicy
             .getLimitOfIncomingSms(LIMIT_NUMBER_OF_SMS_BY_DAY);
     int currentIncomingSmsByWeek = phoneRestrictionPolicy
             .getLimitOfIncomingSms(LIMIT_NUMBER_OF_SMS_BY_WEEK);
     int currentIncomingSmsByMonth = phoneRestrictionPolicy
             .getLimitOfIncomingSms(LIMIT_NUMBER_OF_SMS_BY_MONTH);
 }
 

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

public int getLimitOfOutgoingCalls (int type)

Since: API level 2

API to get the limit on the number of outgoing calls for a day, week, and month. The API returns false if the device has no voice call capability (e.g., a tablet).

Returns
  • The maximum number of incoming calls allowed when successful, else -1.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method returns the restriction limit on the number of outgoing calls based on the parameter passed to it.

For a device managed by multiple administrators, the last limit values set apply. This measure also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 if (phoneRestrictionPolicy.isLimitNumberOfCallsEnabled()) {
     int currentOutgoingCallsByDay = phoneRestrictionPolicy
             .getLimitOfOutgoingCalls(LIMIT_NUMBER_OF_CALLS_BY_DAY);
     int currentOutgoingCallsByWeek = phoneRestrictionPolicy
             .getLimitOfOutgoingCalls(LIMIT_NUMBER_OF_CALLS_BY_WEEK);
     int currentOutgoingCallsByMonth = phoneRestrictionPolicy
             .getLimitOfOutgoingCalls(LIMIT_NUMBER_OF_CALLS_BY_MONTH);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public int getLimitOfOutgoingSms (int type)

Since: API level 2

API to get the limit on outgoing Short Message Service (SMS) text messages for a day, week, or month.

Parameters
type Must be one of the following values:

LIMIT_NUMBER_OF_SMS_BY_DAY
LIMIT_NUMBER_OF_SMS_BY_WEEK
LIMIT_NUMBER_OF_SMS_BY_MONTH

Returns
  • The maximum number of outgoing SMS messages allowed during the time period when successful, else -1.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method returns the restriction limit on the number of outgoing SMS messages based on the time period parameter (day, week, or month) passed to it.

For a device managed by multiple administrators, the last limit values set apply. This setting also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 if (phoneRestrictionPolicy.isLimitNumberOfSmsEnabled()) {
     int currentIncomingSmsByDay = phoneRestrictionPolicy
             .getLimitOfOutgoingSms(LIMIT_NUMBER_OF_SMS_BY_DAY);
     int currentIncomingSmsByWeek = phoneRestrictionPolicy
             .getLimitOfOutgoingSms(LIMIT_NUMBER_OF_SMS_BY_WEEK);
     int currentIncomingSmsByMonth = phoneRestrictionPolicy
             .getLimitOfOutgoingSms(LIMIT_NUMBER_OF_SMS_BY_MONTH);
 }
 

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

public String getOutgoingCallExceptionPatterns ()

Since: API level 11

API to get the exception pattern for outgoing calls.

Returns
  • The concatenated exception pattern for outgoing calls if successful, else null.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to retrieve the current pattern used as exception/whitelist for outgoing calls. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator. The API returns null if the device has no voice call capability (e.g., a tablet).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // get the concatenated exception pattern from the all administrators
     String outgoingCallsPattern = phoneRestrictionPolicy.getOutgoingCallExceptionPatterns();
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public String getOutgoingCallRestriction (boolean allAdmins)

Since: API level 2

API to get the restriction pattern for outgoing calls.

Parameters
allAdmins If true, gets a composition of all restrictions from all administrators. If false, gets restriction pattern from the calling administrator only.
Returns
  • The restriction pattern for outgoing calls if successful, else null.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to retrieve the current pattern used to restrict outgoing calls. The API returns null if the device has no voice call capability (e.g., a tablet).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();
 try {
     // get the restriction pattern from the calling administrator (using parameter
     // false)
     String outgoingCallsPattern = phoneRestrictionPolicy.getOutgoingCallRestriction(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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public String getOutgoingSmsExceptionPatterns ()

Since: API level 11

API to get the exception pattern for outgoing SMSs.

Returns
  • The concatenated exception pattern for outgoing SMSs if successful, else null.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to retrieve the current pattern used as exception/whitelist for outgoing SMSs. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator. The API returns null if the device has no voice call capability (e.g., tablets).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // get the concatenated exception pattern from the all administrators
     String outgoingSMSsPattern = phoneRestrictionPolicy.getOutgoingSmsExceptionPatterns();
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public String getOutgoingSmsRestriction (boolean allAdmins)

Since: API level 2

API to get the restriction pattern for outgoing Short Message Service (SMS) text messages.

Parameters
allAdmins true if pattern from all administrators must be returned, false for the pattern from the calling administrator only.
Returns
  • The pattern combination for outgoing SMS restriction, null if no combination for outgoing SMS restrictions is set or if it fails.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
If the specified parameter is false, this method returns the outgoing SMS restriction pattern for the calling administrator. If the parameter is true, this method returns a combination of all SMS restriction pattern sets by all administrators.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // get the SMS restriction pattern from the calling administrator (when parameter is
     // false)
     String outgoingSmsPattern = phoneRestrictionPolicy.getOutgoingSmsRestriction(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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public Bundle getRCSMessage (long id)

Since: API level 26

Deprecated in API level 35

API to get a Rich Communication Services (RCS) data.

Parameters
id Id of RCS data.
Returns
  • Bundle with RCS data if query is successful, else empty Bundle.
Throws
SecurityException If caller does not have required permissions
Usage
This method returns RCS datas as below using parameters (id) passed to it.

- remote_uri, sender_alias, content_type, body, timestamp for all

- file_path, thumbnail_path for file type

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 long id = intent.getExtras().getLong(EXTRA_MSG_ID);
 
 String action = intent.getAction();
 boolean isFile = false;
 if (ACTION_RCS_MSG_FILE_THUMBNAIL_RECEIVED.equals(action)
        || ACTION_RCS_MSG_FILE_RECEIVED.equals(action)
        || ACTION_RCS_MSG_FILE_SENT.equals(action)) {
     isFile = true;
 }

 Bundle rcsData = phoneRestrictionPolicy.getRCSMessage(id);
 String remoteUri = rcsData.getString(REMOTE_URI);
 String senderAlias = rcsData.getString(SENDER_ALIAS);
 String contentType = rcsData.getString(CONTENT_TYPE);
 String body = rcsData.getString(BODY);
 long timestamp = rcsData.getLong(TIMESTAMP);
 if (isFile) {
     String filePath = rcsData.getString(FILE_PATH);
     String thumbnailPath = rcsData.getString(THUMBNAIL_PATH);
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a protection level of signature.
Since
API level 26
KNOX 3.2
Multiuser Environment
Global Scope

public boolean isBlockMmsWithStorageEnabled ()

Since: API level 6

API to check whether storage of blocked incoming Multimedia Message Service (MMS) messages is enabled.

Returns
  • true if blocked incoming MMS messages are stored for late delivery, else false.
Usage
An administrator can use this API to check whether the blocked incoming MMS are stored for late delivery.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isBlockMmsWithStorageEnabled()) {
         Log.d(TAG, "Blocked incoming MMS are stored for late delivery");
     } else {
         Log.d(TAG, "MMS are not blocked by this policy");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean isBlockSmsWithStorageEnabled ()

Since: API level 6

API to check whether storage of blocked incoming Short Message Service (SMS) text messages is enabled.

Returns
  • true if blocked incoming SMS messages are stored for late delivery, else false.
Usage
An administrator can use this API to check whether blocked incoming SMS messages are stored for late delivery.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isBlockSmsWithStorageEnabled()) {
         Log.d(TAG, "Blocked incoming SMS are stored for late delivery");
     } else {
         Log.d(TAG, "SMS are not blocked by this policy");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean isCallerIDDisplayAllowed ()

Since: API level 6

API to get the display status of caller Id during an incoming call.

Returns
  • true if displaying caller Id is allowed during an incoming call, else false.
Usage
An administrator can use this API to determine whether displaying caller Id is allowed during an incoming call.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isCallerIDDisplayAllowed()) {
         Log.d(TAG, "caller Id display allowed  on call ");
     } else {
         Log.w(TAG, "caller Id display disallowed on call");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean isCopyContactToSimAllowed ()

Since: API level 11

API to check whether the copy.

Returns
  • true if copy contact to SIM is enabled, else false.
Usage
Administrator can check whether contact adding, copy or edition is enabled or not. The default value will be true;

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isCopyContactToSimAllowed()) {
         Log.d(TAG, "Copy, adding or edition of SIM Contact is allowed");
     } else {
         Log.w(TAG, "Copy, adding or edition of SIM Contact is disallowed");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean isIncomingMmsAllowed ()

Since: API level 5

API to determine whether incoming Multimedia Messaging Service (MMS) messages are allowed.

Returns
  • true if incoming MMS messages are allowed, else false.
Usage
An administrator can use this API to determine whether incoming MMS messages are allowed or disallowed.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isIncomingMmsAllowed()) {
         Log.d(TAG, "Incoming MMS is allowed");
     } else {
         Log.w(TAG, "Incoming MMS is disallowed");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public boolean isIncomingSmsAllowed ()

Since: API level 5

API to determine whether incoming Short Message Service (SMS) text messages are allowed.

Returns
  • true if incoming SMS messages are allowed, else false.
Usage
An administrator can use this API to determine whether incoming SMS messages are allowed.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isIncomingSmsAllowed()) {
         Log.d(TAG, "Incoming SMS is allowed");
     } else {
         Log.w(TAG, "Incoming SMS is disallowed");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public boolean isLimitNumberOfCallsEnabled ()

Since: API level 2

API to check whether the number of calls is limited.

Returns
  • true if the number of calls is limited, false if the number of calls is unlimited.
Usage
An administrator can use this method to verify if there is a limitation on the number of calls.

This policy is controlled by the last administrator who called it. For a device managed by multiple administrators, the last limit values apply. This measure also applies to usage counters. The API returns false if the device has no voice call capability (e.g., a tablet).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isLimitNumberOfCallsEnabled()) {
         Log.d(TAG, "Call limit enabled");
     } else {
         Log.w(TAG, "Call limit disabled");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean isLimitNumberOfSmsEnabled ()

Since: API level 2

API to check whether the number of Short Message Service (SMS) text messages is limited.

Returns
  • true if a limit on the number of SMS messages is enabled, false if limiting the number of SMS messages is disabled.
Usage
An administrator can use this API to verify whether the device limits the number of SMS messages.

For a device managed by multiple administrators, the last limit values set apply. This measure also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isLimitNumberOfSmsEnabled()) {
         Log.d(TAG, "SMS limit enabled");
     } else {
         Log.w(TAG, "SMS limit disabled");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean isOutgoingMmsAllowed ()

Since: API level 5

API to determine whether outgoing Multimedia Messaging Service (MMS) messages are allowed.

Returns
  • true if outgoing MMS messages are allowed, else false.
Usage
An administrator can use this API to determine whether outgoing MMS messages are allowed or disallowed.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isOutgoingMmsAllowed()) {
         Log.d(TAG, "Outgoing MMS is allowed");
     } else {
         Log.w(TAG, "Outgoing MMS is disallowed");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public boolean isOutgoingSmsAllowed ()

Since: API level 5

API to determine whether outgoing Short Message Service (SMS) text messages are allowed.

Returns
  • true if outgoing SMS messages are allowed, else false.
Usage
An administrator can use this API to determine whether outgoing SMS messages are allowed.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isOutgoingSmsAllowed()) {
         Log.d(TAG, "Outgoing SMS is allowed");
     } else {
         Log.w(TAG, "Outgoing SMS is disallowed");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public boolean isRCSEnabled (int feature)

Since: API level 29

API to check whether Rich Communication Services (RCS) feature is enabled or not.

Parameters
feature RCS feature options see,
RCS_FEATURE_ALL
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
This API can check which feature are disabled about Rich Communication Services (RCS).

 EnterpriseDeviceManager edm = (EnterpriseDeviceManager)
      getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();
 
 try {
      //check whether the RCS feature is disabled or not.
      boolean result = phoneRestrictionPolicy.isRCSEnabled(PhoneRestrictionPolicy.RCS_FEATURE_ALL));
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature
Since
API level 24
Multiuser Environment
Global Scope

public boolean isWapPushAllowed ()

Since: API level 6

Deprecated in API level 33

API to check whether processing of WAP Push messages is allowed.

Returns
  • true if WAP Push message processing is allowed, false if WAP Push message processing is disallowed.
Usage
An administrator can use this API to check whether processing WAP Push messages is allowed.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.isWapPushAllowed()) {
         Log.d(TAG, "WAP Push processing is allowed");
     } else {
         Log.w(TAG, "WAP Push processing is disallowed");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 

Since
API level 6
MDM 4.0
Multiuser Environment
Global Scope

public boolean removeIncomingCallExceptionPattern ()

Since: API level 11

API to remove the exception pattern (concatenated or not) for incoming calls set by the device administrators.

Returns
  • true if removing incoming call exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrators can use this API to remove the current pattern used to allow incoming calls. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.removeIncomingCallExceptionPattern()) {
         Log.d(TAG, "success removing incoming call exception pattern");
     } else {
         Log.w(TAG, "failed removing incoming call exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean removeIncomingCallRestriction ()

Since: API level 2

API to remove the restriction pattern for incoming calls set by the calling administrator.

Returns
  • true if removing incoming call restriction is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to remove the current pattern used to restrict incoming calls.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.removeIncomingCallRestriction()) {
         Log.d(TAG, "success removing incoming call restriction");
     } else {
         Log.w(TAG, "failed removing incoming call restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean removeIncomingSmsExceptionPattern ()

Since: API level 11

API to remove the exception pattern (concatenated or not) for incoming SMSs set by the device administrators.

Returns
  • true if removing incoming sms exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrators can use this API to remove the current pattern used to allow incoming SMSs. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.removeIncomingSmsExceptionPattern()) {
         Log.d(TAG, "success removing incoming sms exception pattern");
     } else {
         Log.w(TAG, "failed removing incoming sms exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean removeIncomingSmsRestriction ()

Since: API level 2

API to remove the restriction pattern for incoming Short Message Service (SMS) text messages set by the calling administrator.

Returns
  • true if removing incoming SMS restriction pattern was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method removes the incoming SMS restriction pattern set by the calling administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.removeIncomingSmsRestriction()) {
         Log.d(TAG, "success removing incoming SMS restriction");
     } else {
         Log.w(TAG, "failed removing incoming SMS restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean removeOutgoingCallExceptionPattern ()

Since: API level 11

API to remove the exception pattern (concatenated or not) for outgoing calls set by the device administrators.

Returns
  • true if removing outgoing call exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrators can use this API to remove the current pattern used to allow outgoing calls. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.removeOutgoingCallExceptionPattern()) {
         Log.d(TAG, "success removing outgoing call exception pattern");
     } else {
         Log.w(TAG, "failed removing outgoing call exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean removeOutgoingCallRestriction ()

Since: API level 2

API to remove the restriction pattern for outgoing calls set by the calling administrator.

Returns
  • true if removing outgoing call restriction is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to remove the current pattern used to restrict outgoing calls.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.removeOutgoingCallRestriction()) {
         Log.d(TAG, "success removing outgoing call restriction");
     } else {
         Log.w(TAG, "failed removing outgoing call restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean removeOutgoingSmsExceptionPattern ()

Since: API level 11

API to remove the exception pattern (concatenated or not) for incoming SMSs set by the device administrators.

Returns
  • true if removing incoming sms exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrators can use this API to remove the current pattern used to allow incoming SMSs. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.removeIncomingSmsExceptionPattern()) {
         Log.d(TAG, "success removing incoming sms exception pattern");
     } else {
         Log.w(TAG, "failed removing incoming sms exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean removeOutgoingSmsRestriction ()

Since: API level 2

API to remove the restriction pattern for outgoing Short Message Service (SMS) text messages set by the calling administrator.

Returns
  • true if removing outgoing SMS restriction pattern was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method removes the outgoing SMS restriction pattern set by the calling administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.removeOutgoingSmsRestriction()) {
         Log.d(TAG, "success removing outgoing SMS restriction");
     } else {
         Log.w(TAG, "failed removing outgoing SMS restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean resetCallsCount ()

Since: API level 2

API to reset the counters for incoming and outgoing calls.

Returns
  • true if resetting call counters is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method resets all counters for incoming and outgoing calls for each date type (day, week, and month). The limits set for each kind of call are not changed. The API returns false if the device has no voice call capability (e.g., a tablet).

For a device managed by multiple administrators, the last limit values set apply. This measure also applies to usage counters.

  EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
  PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

  phoneRestrictionPolicy.enableLimitNumberOfCalls(true);
  phoneRestrictionPolicy.setLimitOfIncomingCalls(1, 2, 3);
  phoneRestrictionPolicy.setLimitOfOutgoingCalls(1, 2, 3);
  try {
      // Some time after the policy is enabled, the user has probably used some of the quota.
      // The administrator can reset the used quota.
      if (phoneRestrictionPolicy.resetCallsCount())
          Log.d(TAG, "success resetting call used quota");
      } else {
          Log.w(TAG, "failed resetting call used quota");
      }
  } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean resetDataCallLimitCounter ()

Since: API level 2

API to reset the counters for data usage limits sent and received on device.

Returns
  • true if the operation succeed, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method resets the counters for data usage limits for each time period (day, week, and month). The limits set for each period are not changed.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

  try {
      phoneRestrictionPolicy.setDataCallLimitEnabled(true);
      phoneRestrictionPolicy.setLimitOfDataCalls(1, 2, 3);
      // The user has probably used some of the quota
      // during the time period after the policy is enabled.
      // The administrator can reset the used quota by calling this reset method:
      if (phoneRestrictionPolicy.resetDataCallLimitCounter())
          Log.d(TAG, "success resetting data used quota");
      } else {
          Log.w(TAG, "failed resetting data used quota");
      }
  } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean resetSmsCount ()

Since: API level 2

API to reset the counters for incoming or outgoing Short Message Service (SMS) text messages.

Returns
  • true if resetting SMS counts is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method resets all counters for incoming or outgoing SMS messages for each duration period (day, week, and month). The limits set for each period are not changed.

For a device managed by multiple administrators, the last limit values set apply.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 phoneRestrictionPolicy.enableLimitNumberOfSms(true);
 phoneRestrictionPolicy.setLimitOfIncomingSms(1, 2, 3);
 phoneRestrictionPolicy.setLimitOfOutgoingSms(1, 2, 3);
 try {
     // The user has probably used some of the quotas
     // after the policy is enabled.
     // The administrator can reset the used quota by calling this reset method:
     if (phoneRestrictionPolicy.resetSmsCount()) {
         Log.d(TAG, "success resetting SMS used quota");
     } else {
         Log.w(TAG, "failed resetting SMs used quota");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setDataCallLimitEnabled (boolean status)

Since: API level 2

API to enable a limit on data carrier network usage on the device.

Parameters
status true if the device shall limit data call traffic (count amount of data)
Returns
  • true if setting data call limit is enabled successfully, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to enable a limit on data carrier network usage. The default value for this policy is false, which means it is disabled by default.

For a device managed by multiple administrators, the last limit values set apply. This setting also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.setDataCallLimitEnabled(true)) {
         Log.w(TAG, "success enabling data call limit");
     } else {
         Log.w(TAG, "failure enabling data call limit");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setDisclaimerText (String text)

Since: API level 29

Deprecated in API level 35

API to set a disclaimer text for outgoing sms and mms.

@hide_knox

Parameters
text The disclaimer text to be attached on outgoing sms and mms. Pass null to reset.

Note: The maximum supported character length is 30. Since Knox 3.7, it is 60.

Returns
  • true if setting disclaimer text is successful, false if other admin already set disclaimer text or text is over the maximum supported character length.
Throws
SecurityException If caller does not have required permissions
Usage
This API will set a disclaimer text which will be attached on outgoing sms and mms

 EnterpriseDeviceManager edm = (EnterpriseDeviceManager)
      getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();
 
 try {
     // set a new disclaimer text
     String text = "sampleurl";
     if (phoneRestrictionPolicy.setDisclaimerText("text")) {
         Log.d(TAG, "success setting disclaimer text");
     } else {
         Log.w(TAG, "failed setting disclaimer text");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature
Since
API level 21
MDM 5.7.1
Multiuser Environment
Global Scope

public boolean setEmergencyCallOnly (boolean enable)

Since: API level 2

API to enable or disable emergency calls only on device.

Parameters
enable Enables emergency calls only.
Returns
  • true if setting emergency call only is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
If enabled, only emergency calls are allowed. All other calls and messages are blocked. The API returns false if the device has no voice call capability (e.g., a tablet).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.setEmergencyCallOnly(true)) {
         Log.d(TAG, "success blocking all calls except emergency");
     } else {
         Log.w(TAG, "failed blocking all calls except emergency");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setIncomingCallExceptionPattern (String pattern)

Since: API level 11

API to set an exception pattern to be matched by incoming call numbers.

Parameters
pattern The exception pattern to be matched against the incoming call number.
Returns
  • true if setting incoming call exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
This API overrides any exception pattern previously set by the administrator for incoming calls. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator. The API returns false if the device has no voice call capability (e.g., tablets).

See setOutgoingCallExceptionPattern(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // set a new pattern to block all incoming calls
     if (phoneRestrictionPolicy.setIncomingCallExceptionPattern(".*")) {
         Log.d(TAG, "success setting incoming call exception pattern");
     } else {
         Log.w(TAG, "failed setting incoming call exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean setIncomingCallRestriction (String pattern)

Since: API level 2

API to set a restriction pattern to be matched by incoming call numbers.

Parameters
pattern The restriction pattern to be matched against the incoming call number.
Returns
  • true if setting incoming call restriction was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This API overrides any pattern previously set by the administrator for incoming calls. The API returns false if the device has no voice call capability (e.g., a tablet).

See setOutgoingCallRestriction(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // set a new pattern to block all incoming calls
     if (phoneRestrictionPolicy.setIncomingCallRestriction(".*")) {
         Log.d(TAG, "success setting incoming call restriction");
     } else {
         Log.w(TAG, "failed setting incoming call restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setIncomingSmsExceptionPattern (String pattern)

Since: API level 11

API to set an exception pattern to be matched by incoming SMS numbers.

Parameters
pattern The exception pattern to be matched against the incoming SMS number.
Returns
  • true if setting incoming SMS exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
This API overrides any exception pattern previously set by the administrator for incoming SMSs. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator. The API returns false if the device has no voice call capability (e.g., tablets).

See setOutgoingSmsExceptionPattern(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // set a new pattern to block all incoming SMSs
     if (phoneRestrictionPolicy.setIncomingSmsExceptionPattern(".*")) {
         Log.d(TAG, "success setting incoming SMS exception pattern");
     } else {
         Log.w(TAG, "failed setting incoming SMS exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean setIncomingSmsRestriction (String pattern)

Since: API level 2

API to set incoming Short Message Service (SMS) text message restriction pattern for the calling administrator.

Parameters
pattern The restriction pattern.
Returns
  • true if setting incoming SMS restriction is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method overrides any previously set pattern in the database or adds a new one if none exist.

See setOutgoingCallRestriction(String) to get regular expression samples to use in pattern methods.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // set a new pattern to block all incoming SMS
     if (phoneRestrictionPolicy.setIncomingSmsRestriction(".*")) {
         Log.d(TAG, "success setting incoming SMS restriction");
     } else {
         Log.w(TAG, "failed setting incoming SMS restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setLimitOfDataCalls (long limitByDay, long limitByWeek, long limitByMonth)

Since: API level 2

API to set the limit on data packet usage per day, week, and month.

Parameters
limitByDay The maximum number of bytes per day.
limitByWeek The maximum number of bytes per week.
limitByMonth The maximum number of bytes per month.

Returns
  • true if setting limit on data network usage is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this interface to limit the amount of data packets sent or received through the carrier data network by day, week, and month.

For a device managed by multiple administrators, the last limit values set apply. This setting also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.setDataCallLimitEnabled(true)) {
         // Set the data usage limit to 100MB by day, 500MB by week, 1GB by month
         if (mPhoneRestrictionPolicy.setLimitOfDataCalls(104857600, 524288000, 1073741824)) {
             Log.d(TAG, "success setting data usage limits");
         } else {
             Log.w(TAG, "failure setting data usage limits");
         }
     } else {
         Log.w(TAG, "failure enabling data usage limits");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setLimitOfIncomingCalls (int limitByDay, int limitByWeek, int limitByMonth)

Since: API level 2

API to set the limit for the number of incoming calls per day, week, and month.

Parameters
limitByDay The maximum number of incoming calls for a day.
limitByWeek The maximum number of incoming calls for a week.
limitByMonth The maximum number of incoming calls for a month.
Returns
  • true if setting the limit of incoming calls was successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to set a limit to the number of incoming calls by day, week, or month. Passing "0" as a parameter means that there is no limit on the number of calls for that duration period (day, week or month).

For a device managed by multiple administrators, the last limit values set apply. This measure also applies to usage counters. The API returns false if the device has no voice call capability (e.g., a tablet).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.enableLimitNumberOfCalls(true)) {
         // Set the incoming call limit to 5 by day, no limit by week, 100 by
         // month
         if (phoneRestrictionPolicy.setLimitOfIncomingCalls(5, 0, 100)) {
             Log.d(TAG, "success setting incoming call limits");
         } else {
             Log.w(TAG, "failure setting incoming call limits");
         }
     } else {
         Log.w(TAG, "failure enabling call limits");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setLimitOfIncomingSms (int limitByDay, int limitByWeek, int limitByMonth)

Since: API level 2

API to set a limit on the number of incoming Short Message Service (SMS) text messages per day, week, and month.

Parameters
limitByDay The maximum number of incoming SMS messages for a day.
limitByWeek The maximum number of incoming SMS messages for a week.
limitByMonth The maximum number of incoming SMS messages for a month.
Returns
  • true if setting a limit on the number of incoming SMS messages is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to set a limit on the number of incoming SMS messages by day, week, and month. Passing "0" as a parameter means that there is no limit on the number of incoming SMS messages for the related period (day, week, or month).

For a device managed by multiple administrators, the last limit values set apply. This setting also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.enableLimitNumberOfSms(true)) {
         // Set the incoming SMS message limit to 10 by day, no limit by week, no limit
         // by month
         if (phoneRestrictionPolicy.setLimitOfIncomingSms(10, 0, 0)) {
             Log.d(TAG, "success setting incoming SMS limits");
         } else {
             Log.w(TAG, "failure setting incoming SMS limits");
         }
     } else {
         Log.w(TAG, "failure enabling SMS limits");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setLimitOfOutgoingCalls (int limitByDay, int limitByWeek, int limitByMonth)

Since: API level 2

API to set the limit for the number of outgoing calls per day, week, and month. The API returns false if the device has no voice call capability (e.g., a tablet).

Parameters
limitByDay The maximum number of outgoing calls for a day.
limitByWeek The maximum number of outgoing calls for a week.
limitByMonth The maximum number of outgoing calls for a month.
Returns
  • true if setting the limit of outgoing calls is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API to set a limit to the number of outgoing calls by day, week, and month. Passing "0" as a parameter means that there is no limit on the number of calls for the related duration period (day, week, or month).

For a device managed by multiple administrators, the last limit values set apply. This measure also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.enableLimitNumberOfCalls(true)) {
         // Set the outgoing call limit to 10 by day, no limit by week, no limit
         // by month
         if (phoneRestrictionPolicy.setLimitOfOutgoingCalls(10, 0, 0)) {
             Log.d(TAG, "success setting outgoing call limits");
         } else {
             Log.w(TAG, "failure setting outgoing call limits");
         }
     } else {
         Log.w(TAG, "failure enabling call limits");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setLimitOfOutgoingSms (int limitByDay, int limitByWeek, int limitByMonth)

Since: API level 2

API to set a limit of number of outgoing Short Message Service (SMS) text messages per day, week, and month.

Parameters
limitByDay The maximum number of outgoing SMS messages for a day.
limitByWeek The maximum number of outgoing SMS messages for a week.
limitByMonth The maximum number of outgoing SMS messages for a month.
Returns
  • true if setting limit on outgoing SMS is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
An administrator can use this API set a limit on the number of outgoing SMS messages by day, week, and month. Passing "0" as a parameter means that there is no limit on the number of outgoing SMS messages for the related period (day, week, or month).

For a device managed by multiple administrators, the last limit values set apply. This setting also applies to usage counters.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     if (phoneRestrictionPolicy.enableLimitNumberOfSms(true)) {
         // Set the outgoing SMS message limit to 5 by day, 20 by week, 100 by month
         if (phoneRestrictionPolicy.setLimitOfOutgoingSms(5, 20, 100)) {
             Log.d(TAG, "success setting outgoing SMS limits");
         } else {
             Log.w(TAG, "failure setting outgoing SMS limits");
         }
     } else {
         Log.w(TAG, "failure enabling SMS limits");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setOutgoingCallExceptionPattern (String pattern)

Since: API level 11

API to set an exception pattern to be matched by outgoing call numbers.

Parameters
pattern The exception pattern to be matched against the outgoing call number.
Returns
  • true if setting the outgoing call exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
This API overrides any exception pattern previously set by the administrator for outgoing calls. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator. The API returns false if the device has no voice call capability (e.g., tablets).

Some regular expresions accepted:

.* allows ALL outgoing phone calls.

011.* allows all outgoing phone calls to any number starting with 011 (international code). For example, numbers NOT whitelisted include 8001234567, 8005557890, 18001234567, 800-123-4567, 1-800-1234-567, 800123456, 80012345678, 5551234567, and 8015557890. Example of a number allowed includes 011551912345678.

(900[0-9]{7}$).* allows all outgoing calls to 900[exactly seven digits]. For example, numbers allowed include 9001234567 and 9005557890.

(900[\-]?[0-9]{3}[\-]?[0-9]{4}$).* same as above plus optional dashes. For example, numbers allowed include 9001234567, 900-555-7890, 900-9001234, and 900123-4567 NOTE: The backslash before the hyphen indicates treating the hyphen as a literal, not as a regex symbol.

(?!800[0-9]{7}$).* allows all outgoing calls EXCEPT to 800[exactly seven digits]. For example, numbers NOT whitelisted include 8001234567, and 8005557890. Examples of numbers allowed include 800123456, 80012345678, 800-123-4567, 18001234567, 1-800-1234-567, 5551234567, 8015557890, and 011551912345678.

(?![1]?800[0-9]{7}$).* allows all outgoing calls EXCEPT to [optional digit "1"]800[exactly seven digits]. For example, numbers NOT whitelisted include 8001234567, 8005557890, and 18001234567. Examples of numbers allowed include 800123456, 80012345678, 800-123-4567, 1-800-1234-567, 5551234567, 8015557890, and 011551912345678. NOTE: The international code may or may not be sent by cellular carrier. Some of the possibilities include 1[number], 1-[number], +1[number], +1-[number].

(?![1]?[\-]?800[\-]?[0-9]{3}[\-]?[0-9]{4}$).* same as above plus optional dashes. For example, numbers NOT whitelisted include 8001234567, 8005557890, 18001234567, 800-123-4567, and 1-800-1234-567. Examples of numbers blocked include 800123456, 80012345678, 5551234567, 8015557890, and 011551912345678.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // Note that double backslashes are needed when writing the
     // string in Java.
     if (phoneRestrictionPolicy
             .setOutgoingCallExceptionPattern("(?![1]?[\\-]?800[\\-]?[0-9]{3}[\\-]?[0-9]{4}$).*")) {
         Log.d(TAG, "successful setting outgoing call exception pattern");
     } else {
         Log.w(TAG, "failed setting outgoing call exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean setOutgoingCallRestriction (String pattern)

Since: API level 2

API to set a restriction pattern to be matched by outgoing call numbers.

Parameters
pattern The restriction pattern to be matched against the outgoing call number.
Returns
  • true if setting the outgoing call restriction is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This API overrides any pattern previously set by the administrator for outgoing calls. The API returns false if the device has no voice call capability (e.g., a tablet).

Some regular expresions accepted:

.* blocks ALL outgoing phone calls.

011.* blocks all outgoing phone calls to number started with 011 (international code). For example, numbers NOT blocked include 8001234567, 8005557890, 18001234567, 800-123-4567, 1-800-1234-567, 800123456, 80012345678, 5551234567, and 8015557890. Example of a number blocked includes 011551912345678.

(900[0-9]{7}$).* blocks all outgoing calls to 900[exactly seven digits]. For example, numbers blocked include 9001234567 and 9005557890.

(900[\-]?[0-9]{3}[\-]?[0-9]{4}$).* same as above plus optional dashes. For example, numbers blocked include 9001234567, 900-555-7890, 900-9001234, and 900123-4567 NOTE: The backslash before the hyphen indicates treating the hyphen as a literal, not as a regex symbol.

(?!800[0-9]{7}$).* blocks all outgoing calls EXCEPT to 800[exactly seven digits]. For example, numbers NOT blocked include 8001234567, and 8005557890. Examples of numbers blocked include 800123456, 80012345678, 800-123-4567, 18001234567, 1-800-1234-567, 5551234567, 8015557890, and 011551912345678.

(?![1]?800[0-9]{7}$).* blocks all outgoing calls EXCEPT to [optional digit "1"]800[exactly seven digits]. For example, numbers NOT blocked include 8001234567, 8005557890, and 18001234567. Examples of numbers blocked include 800123456, 80012345678, 800-123-4567, 1-800-1234-567, 5551234567, 8015557890, and 011551912345678. NOTE: The international code may or may not be sent the by cellular carrier. Some of the possibilities include 1[number], 1-[number], +1[number], +1-[number].

(?![1]?[\-]?800[\-]?[0-9]{3}[\-]?[0-9]{4}$).* same as above plus optional dashes. For example, numbers NOT blocked include 8001234567, 8005557890, 18001234567, 800-123-4567, and 1-800-1234-567. Examples of numbers blocked include 800123456, 80012345678, 5551234567, 8015557890, and 011551912345678.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // Note that double backslashes are needed when writing the
     // string in Java.
     if (phoneRestrictionPolicy
             .setOutgoingCallRestriction("(?![1]?[\\-]?800[\\-]?[0-9]{3}[\\-]?[0-9]{4}$).*")) {
         Log.d(TAG, "successful setting outgoing call restriction");
     } else {
         Log.w(TAG, "failed setting outgoing call restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public boolean setOutgoingSmsExceptionPattern (String pattern)

Since: API level 11

API to set an exception pattern to be matched by outgoing SMS numbers.

Parameters
pattern The exception pattern to be matched against the outgoing SMS number.
Returns
  • true if setting the outgoing SMS exception pattern is successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
This API overrides any exception pattern previously set by the administrator for outgoing SMSs. The exception pattern works as a whitelist against the restriction pattern for the same administrator who set it, but has no priority over restriction pattern set by other administrator. The API returns false if the device has no voice call capability (e.g., tablets).

Some regular expresions accepted:

.* allows ALL outgoing phone SMSs.

011.* allows all outgoing phone SMSs to any number starting with 011 (international code). For example, numbers NOT whitelisted include 8001234567, 8005557890, 18001234567, 800-123-4567, 1-800-1234-567, 800123456, 80012345678, 5551234567, and 8015557890. Example of a number allowed includes 011551912345678.

(900[0-9]{7}$).* allows all outgoing SMSs to 900[exactly seven digits]. For example, numbers allowed include 9001234567 and 9005557890.

(900[\-]?[0-9]{3}[\-]?[0-9]{4}$).* same as above plus optional dashes. For example, numbers allowed include 9001234567, 900-555-7890, 900-9001234, and 900123-4567 NOTE: The backslash before the hyphen indicates treating the hyphen as a literal, not as a regex symbol.

(?!800[0-9]{7}$).* allows all outgoing SMSs EXCEPT to 800[exactly seven digits]. For example, numbers NOT whitelisted include 8001234567, and 8005557890. Examples of numbers allowed include 800123456, 80012345678, 800-123-4567, 18001234567, 1-800-1234-567, 5551234567, 8015557890, and 011551912345678.

(?![1]?800[0-9]{7}$).* allows all outgoing SMSs EXCEPT to [optional digit "1"]800[exactly seven digits]. For example, numbers NOT whitelisted include 8001234567, 8005557890, and 18001234567. Examples of numbers allowed include 800123456, 80012345678, 800-123-4567, 1-800-1234-567, 5551234567, 8015557890, and 011551912345678. NOTE: The international code may or may not be sent by cellular carrier. Some of the possibilities include 1[number], 1-[number], +1[number], +1-[number].

(?![1]?[\-]?800[\-]?[0-9]{3}[\-]?[0-9]{4}$).* same as above plus optional dashes. For example, numbers NOT whitelisted include 8001234567, 8005557890, 18001234567, 800-123-4567, and 1-800-1234-567. Examples of numbers blocked include 800123456, 80012345678, 5551234567, 8015557890, and 011551912345678.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // Note that double backslashes are needed when writing the
     // string in Java.
     if (phoneRestrictionPolicy
             .setOutgoingSmsExceptionPattern("(?![1]?[\\-]?800[\\-]?[0-9]{3}[\\-]?[0-9]{4}$).*")) {
         Log.d(TAG, "successful setting outgoing SMS exception pattern");
     } else {
         Log.w(TAG, "failed setting outgoing SMS exception pattern");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.

Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public boolean setOutgoingSmsRestriction (String pattern)

Since: API level 2

API to set the outgoing Short Message Service (SMS) text message restriction pattern for the calling administrator.

Parameters
pattern The restriction pattern.
Returns
  • true if setting outgoing SMS restriction is successful, else false.
Throws
SecurityException If caller does not have required permissions
UnsupportedOperationException If caller specifies an iccId at getPhoneRestrictionPolicy(String).
Usage
This method overrides any previously set pattern in the database or adds a new one if none exist.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();

 try {
     // set a new pattern to block all outgoing SMS
     if (phoneRestrictionPolicy.setOutgoingSmsRestriction(".*")) {
         Log.d(TAG, "success setting outgoing SMS restriction");
     } else {
         Log.w(TAG, "failed setting outgoing SMS restriction");
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
Global Scope

public int setRCSEnabled (int feature, boolean enable)

Since: API level 24

API to enable or disable Rich Communication Services (RCS) features on device native message apps(e.g. Samsung message app, Google Message app).

Parameters
feature RCS feature options see,
RCS_FEATURE_ALL
enable true to enable, else false
Throws
SecurityException If caller does not have required permissions
Usage
This API can enable or disable the rich communciation service. The user cannot enable the RCS feature once it is disabled.

 EnterpriseDeviceManager edm = (EnterpriseDeviceManager)
      getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
 PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy();
 
 try {
     if (phoneRestrictionPolicy.setRCSEnabled(PhoneRestrictionPolicy.RCS_FEATURE_ALL, false)==PhoneRestrictionPolicy.ERROR_NONE) {
         // disable all RCS features (call, message) 
     } else {
         // default behavior. user can use RCS text message and call on device.
     }
 } 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_PHONE_RESTRICTION" permission which has a protection level of signature
Since
API level 24
Multiuser Environment
Global Scope