java.lang.Object | |
↳ | com.samsung.android.knox.accounts.ExchangeAccountPolicy |
Deprecated in API level 27
This class provides APIs to configure Microsoft Exchange ActiveSync account-related settings and to create and delete Microsoft Exchange ActiveSync accounts. Some configuration value has dependency on Microsoft Exchange ActiveSync protocol version.
API level 1 |
MDM 1.0 |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ACTION_CBA_INSTALL_STATUS | Broadcast action: To notify user of certificate installation status for certificate-based authentication (CBA). | |||||||||
String | ACTION_ENFORCE_SMIME_ALIAS_RESULT | Broadcast Action: To notify an administrator about smime certificate
alias enforcement status which will be sent after calling
setForceSMIMECertificateAlias(long, String, int) or
setForceSMIMECertificateAlias(long, String, String, int) . |
|||||||||
String | ACTION_EXCHANGE_ACCOUNT_ADD_RESULT | Broadcast Action: To notify an administrator about account create/update operations status which will be sent after accounts setting validation.This intent can be sent several times for one account; an example is when settings validation failed because the user initially entered the wrong password and later retried by entering the correct value.. | |||||||||
String | ACTION_EXCHANGE_ACCOUNT_DELETE_RESULT | Broadcast Action: To notify administrator about account delete operations status. | |||||||||
int | ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT | SMIME certificate alias enforcement operation type for Encryption. | |||||||||
int | ENFORCE_SMIME_ALIAS_TYPE_SIGN | SMIME certificate alias enforcement operation type for Signing. | |||||||||
int | ERROR_SET_SMIME_CERTIFICATE_NONE | Flag indicating force SMIME certificate operation was successful. | |||||||||
int | ERROR_SET_SMIME_CERTIFICATE_NOT_FOUND | Flag indicating if certificate alias could not be found at keystore (in case either
setForceSMIMECertificateAlias(long, String, int) or
setForceSMIMECertificateAlias(long, String, String, int) was called)
on forcing SMIME certificate. |
|||||||||
int | ERROR_SET_SMIME_CERTIFICATE_UNKNOWN | Flag indicating an unknown error on forcing SMIME certificate. | |||||||||
String | EXTRA_ACCOUNT_ID | The lookup key for long object. | |||||||||
String | EXTRA_EMAIL_ADDRESS | The lookup key for String object. |
|||||||||
String | EXTRA_ENFORCE_SMIME_ALIAS_TYPE | The lookup key for integer object. | |||||||||
String | EXTRA_RESULT | The lookup key for integer object. | |||||||||
String | EXTRA_SERVER_ADDRESS | The lookup key for String object. |
|||||||||
String | EXTRA_SMIME_RESULT | The lookup key for integer object. | |||||||||
String | EXTRA_STATUS | The lookup key for an object. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
| |||||||||||
Deprecated
in API level 27
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Broadcast action: To notify user of certificate installation status for certificate-based authentication (CBA). The intent has the following extra values:
The parcelable extraEXTRA_STATUS
is
also contained in this intent, which identifies the status of the certificate installation initiated
using API setClientAuthCert(byte[], String, long)
API level 2 |
MDM 2.0 |
Broadcast Action: To notify an administrator about smime certificate
alias enforcement status which will be sent after calling
setForceSMIMECertificateAlias(long, String, int)
or
setForceSMIMECertificateAlias(long, String, String, int)
.
The intent will have the following extra values:
EXTRA_ENFORCE_SMIME_ALIAS_TYPE
EXTRA_ACCOUNT_ID
EXTRA_SMIME_RESULT
The use of this intent requires the user to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 15 |
MDM 5.4 |
Broadcast Action: To notify an administrator about account create/update operations status which will be sent after accounts setting validation.This intent can be sent several times for one account; an example is when settings validation failed because the user initially entered the wrong password and later retried by entering the correct value..
The intent has the following extra values:
EXTRA_RESULT
EXTRA_EMAIL_ADDRESS
EXTRA_SERVER_ADDRESS
EXTRA_ACCOUNT_ID
The use of this intent requires the user to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 6 |
MDM 4.0 |
Broadcast Action: To notify administrator about account delete operations status.
The intent has the following extra values:
EXTRA_RESULT
EXTRA_EMAIL_ADDRESS
EXTRA_SERVER_ADDRESS
EXTRA_ACCOUNT_ID
The use of this intent requires the user to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 6 |
MDM 4.0 |
SMIME certificate alias enforcement operation type for Encryption.
API level 15 |
MDM 5.4 |
SMIME certificate alias enforcement operation type for Signing.
API level 15 |
MDM 5.4 |
Flag indicating force SMIME certificate operation was successful.
API level 6 |
MDM 4.0 |
Flag indicating if certificate alias could not be found at keystore (in case either
setForceSMIMECertificateAlias(long, String, int)
or
setForceSMIMECertificateAlias(long, String, String, int)
was called)
on forcing SMIME certificate.
API level 6 |
MDM 4.0 |
Flag indicating an unknown error on forcing SMIME certificate.
API level 6 |
MDM 4.0 |
The lookup key for long object. Retrieve with getLongExtra(String, long). Account Id in email database or -1 in case account creation, account update, and deletion of nonvalidating accounts.
API level 6 |
MDM 4.0 |
The lookup key for String
object. Retrieve with getStringExtra(String).
Account email address used to identify account.
API level 6 |
MDM 4.0 |
The lookup key for integer object. Retrieve with getIntExtra(String, int). SMIME certificate alias enforcement operation type.
API level 15 |
MDM 5.4 |
The lookup key for integer object. Retrieve with getIntExtra(String, int). Status for account creation/update/delete
API level 6 |
MDM 4.0 |
The lookup key for String
object. Retrieve with getStringExtra(String).
Account exchange server host address used to identify account.
API level 6 |
MDM 4.0 |
The lookup key for integer object. Retrieve with getIntExtra(String, int). Status for SMIME Certificate enforcement.
API level 15 |
MDM 5.4 |
The lookup key for an object. Retrieve with getIntExtra(String, int). If successfully installed, status is "0", and on any failure, status is "1".
API level 2 |
MDM 2.0 |
Deprecated in API level 27
API to add a new Microsoft Exchange account with base parameters.
account | Exchange account class of the account
NOTE : All other settings values are set to default. |
---|
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure a Microsoft Exchange ActiveSync account on the user's device without user interaction. Most of these settings can be changed by the user except 'domain' and 'username'. Exchange account base parameters: Exchange Account class. The administrator can register The administrator can use NOTE: On Android version 4.0 onwards: |
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm. getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.addNewAccount(new ExchangeAccount( "testeasid@easserver.com", "testeasid","easDomain", "easserver.com", "Password@123")); if(accountId >= 0){ Log.d(TAG,"Add a new exchange account with base parameters succeeded!"); // Administrator needs to call sendAccountsChangedBroadcast() API // to notify about the Microsoft Exchange account addition. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG," Add a new exchange account with base parameters failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm. getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.addNewAccount(new ExchangeAccount( "testeasid@easserver.com", "testeasid","easDomain", "easserver.com", "Password@123")); if(accountId >= 0){ Log.d(TAG,"Add a new exchange account with base parameters succeeded!"); // Administrator needs to call sendAccountsChangedBroadcast() API // to notify about the Microsoft Exchange account addition. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG," Add a new exchange account with base parameters failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection
level of signature. Depending on the Credential Storage type identified by certificateStorageName attribute, a new permission will
also be enforced. System Credential Storages will check for
'com.samsung.android.knox.permission.KNOX_UCM_ESE_MGMT' permission,
while non-system ones check for
'com.samsung.android.knox.permission.KNOX_UCM_OTHER_MGMT' permission.
Please refer to Universal Credential Manager (UCM) DEV guide
in order to have more details of how to get these new
permissions. |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to enable or disable incoming attachments for Exchange accounts.
enable | true to enable attachment |
---|---|
accId | The exchange account id to enable attachment |
true
if successful, false
otherwiseSecurityException | If caller does not have required permissions |
---|
An administrator can use this API to enable or disable incoming attachments for Exchange accounts. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.allowInComingAttachments(false,accId); if (true == enable) { // administrator has disabled Incoming attachments for Exchange accounts. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.allowInComingAttachments(false, accId); if (true == enable) { // administrator has disabled Incoming attachments for Exchange accounts. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to delete an account.
accId | Id of account to be deleted |
---|
true
if account deleted successfully,
else false
.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely delete a Microsoft Exchange ActiveSync account and all
related data without user interaction. The key to using this API is the enterprise Microsoft Exchange ActiveSync
account Id, which is obtained using getAccountId(String, String, String) .
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.deleteAccount( accountId); if(result){ Log.d(TAG,"deleting account succeede!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account deletion. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"deleting account failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.deleteAccount( accountId); if(result){ Log.d(TAG,"deleting account succeede!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account deletion. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"deleting account failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to get account details.
accId | Id of account containing the details to be queried |
---|
null
.SecurityException | If caller does not have required permissions |
---|
An administrator can use this utility API to obtain the details of a
particular Microsoft Exchange ActiveSync account. The key to using this API is
the enterprise Microsoft Exchange ActiveSync account Id, which is obtained using
getAccountId(String, String, String) .
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); Account mAccnt = exchangeAccountPolicy.getAccountDetails( accountId); if(mAccnt != null){ Log.d(TAG," return account details are not null (account exists)!"); }else{ Log.d(TAG," return account details are null (account does not exist)."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); Account mAccnt = exchangeAccountPolicy.getAccountDetails( accountId); if(mAccnt != null){ Log.d(TAG," return account details are not null (account exists)!"); }else{ Log.d(TAG," return account details are null (account does not exist)."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to get the Id of an account with given details.
easDomain | Domain name of the account |
---|---|
easUser | User name of the account |
activeSyncHost | Server address of the account |
SecurityException | If caller does not have required permissions |
---|
An administrator can use this utility API to obtain the account Id of a particular Microsoft Exchange ActiveSync account. A Microsoft Exchange ActiveSync account is uniquely represented by a combination of the 'domain name', 'user name', and 'ActiveSync host'. All parameters for this API are case sensitive. |
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); if(accountId >0){ Log.d(TAG," get account Id is valid/successful!"); }else{ Log.d(TAG," get account Id is invalid/failure."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); if(accountId >0){ Log.d(TAG," get account Id is valid/successful!"); }else{ Log.d(TAG," get account Id is invalid/failure."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to get all Microsoft Exchange ActiveSync account information as a list.
null
.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to get information on all existing Microsoft Exchange accounts on the device. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { Account[] accounts = exchangeAccountPolicy.getAllEASAccounts() ; if(accounts!= null){ Log.d(TAG,"Retrieving Microsoft Exchange account detail succeeded! One or more accounts exist."); }else{ Log.d(TAG," No Microsoft Exchange accounts exist."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { Account[] accounts = exchangeAccountPolicy.getAllEASAccounts() ; if(accounts!= null){ Log.d(TAG,"Retrieving Microsoft Exchange account detail succeeded! One or more accounts exist."); }else{ Log.d(TAG," No Microsoft Exchange accounts exist."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 2 |
MDM 2.0 |
User Scope |
Deprecated in API level 27
API to get the unique device Id generated by the Microsoft Exchange ActiveSync protocol.
null
.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to get the unique device Id generated by the Microsoft Exchange ActiveSync protocol. This task is a long running operation. The API should be called from a worker thread rather than the main UI thread to ensure the best UI performance. You can use AsyncTask or Handler to communicate with the main UI thread. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); String deviceId = exchangeAccountPolicy.getDeviceId(); if(deviceId != null){ Log.d(TAG," Device Id:" +deviceId); }else{ Log.d(TAG," Device Id is null" ); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); String deviceId = exchangeAccountPolicy.getDeviceId(); if(deviceId != null){ Log.d(TAG," Device Id:" +deviceId); }else{ Log.d(TAG," Device Id is null" ); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 2 |
MDM 2.0 |
User Scope |
Deprecated in API level 27
API to get maximum attachment size allowed for Exchange accounts. (byte)
accId | The exchange account id to get maximum attachment size. |
---|
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to get maximum attachment size allowed for Exchange accounts. (byte) |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getIncomingAttachmentsSize(accId); // Incoming attachments of Exchange accounts is enable. } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getIncomingAttachmentsSize(accId); // Incoming attachments of Exchange accounts is enable. } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to get maximum calendar age of Exchange accounts.
accId | The exchange account id to get maximum Calendar sync period. |
---|
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to get maximum calendar age of Exchange accounts. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getMaxCalendarAgeFilter(accId); // All(value 0), 2 weeks(value 1), 1 months(value 2), 3 months(value 3), 6 months (value 4) } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getMaxCalendarAgeFilter(accId); // All(value 0), 2 weeks(value 1), 1 months(value 2), 3 months(value 3), 6 months (value 4) } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to get maximum Email age of Exchange accounts.
accId | The exchange account id to get maximum Email sync period. |
---|
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to get maximum Email age of Exchange accounts. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getMaxEmailAgeFilter(accId); // All(value 0), 2 weeks(value 1), 1 months(value 2), 3 months(value 3), 6 months (value 4) } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { int value = exchangeAccountPolicy.getMaxEmailAgeFilter(accId); // All(value 0), 2 weeks(value 1), 1 months(value 2), 3 months(value 3), 6 months (value 4) } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to get maximum Email Body Truncation size of Exchange accounts. (kbyte)
accId | The exchange account id to get maximum Email Body Truncation Size. |
---|
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to get maximum Email Body Truncation size of Exchange accounts. (kbyte) |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getMaxEmailBodyTruncationSize(accId); } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getMaxEmailBodyTruncationSize(accId); } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to get maximum Email HTML Body Truncation size of Exchange accounts. (kbyte)
accId | The exchange account id to get maximum Email HTML Body Truncation Size. |
---|
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to get maximum Email HTML Body Truncation size of Exchange accounts. (kbyte) |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getMaxEmailHTMLBodyTruncationSize(accId); } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { int value = exchangeAccountPolicy.getMaxEmailHTMLBodyTruncationSize(accId); } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to determine whether encrypted S/MIME messages are required for an exchange account.
accId | The exchange account id. |
---|
true
if encrypted S/MIME messages are required, false
otherwise.An administrator can use this API to get status of the S/MIME encryption requirement for an exchange account.* |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.getRequireEncryptedSMIMEMessages(accId); if (true == enable) { // encrypted S/MIME messages are required for this account } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.getRequireEncryptedSMIMEMessages(accId); if (true == enable) { // encrypted S/MIME messages are required for this account } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 6 |
MDM 4.0 |
User Scope |
Deprecated in API level 27
API to determine whether using S/MIME certificate is required to sign messages. for the given exchange account.
accId | The exchange account id. |
---|
true
if signed S/MIME messages are required, false
otherwise.An administrator can use this API to get status of S/MIME signing requirement for an exchange account. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.getRequireSignedSMIMEMessages(accId); if (true == enable) { // signed S/MIME messages are required for this account } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.getRequireSignedSMIMEMessages(accId); if (true == enable) { // signed S/MIME messages are required for this account } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 6 |
MDM 4.0 |
User Scope |
Deprecated in API level 27
API to retrieve the certificate alias used for S/MIME messages for specific Exchange account.
accId | Exchange account Id |
---|---|
type | Operation type either ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT or ENFORCE_SMIME_ALIAS_TYPE_SIGN |
null
otherwise. In case certificate has been enforced with
setForceSMIMECertificateAlias(long, String, String, int)
API, the alias will be returned in an URI format, which contains
the storage name information.EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; int type = 1; // ExchangeAccountPolicy.ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT; try { String alias = exchangeAccountPolicy.getSMIMECertificateAlias(accId, type); } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; int type = 1; // ExchangeAccountPolicy.ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT; try { String alias = exchangeAccountPolicy.getSMIMECertificateAlias(accId, type); } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 15 |
MDM 5.4 |
User Scope |
Deprecated in API level 27
API to check whether incoming attachments of Exchange accounts are allowed.
accId | The exchange account id to get state of attachemnt enable |
---|
true
if Incoming attachments of Exchange are enabled, false
otherwise.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to check whether incoming attachments of Exchange accounts are allowed. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.isIncomingAttachmentsAllowed(accId); if (true == enable) { // Incoming attachments of Exchange accounts are enable. } else{ // Incoming attachments of Exchange accounts are disable. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.isIncomingAttachmentsAllowed(accId); if (true == enable) { // Incoming attachments of Exchange accounts are enable. } else{ // Incoming attachments of Exchange accounts are disable. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to remove account which is still pending creation.
emailAddress | Email Address of the exchange account |
---|---|
easUser | User name of the exchange account |
easDomain | Domain name of the exchange account |
serverAddress | Address of the exchange server e.g "mail.xyz.com" |
SecurityException | If caller does not have required permissions |
---|
Administrator can use this API to remove pending Exchange account from the device. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { exchangeAccountPolicy.removePendingAccount("testeasid@easserver.com", "testeasid", "easserver.com", "mail.easserver.com"); } catch (SecurityException e) { Log.w(TAG, "SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { exchangeAccountPolicy.removePendingAccount("testeasid@easserver.com", "testeasid", "easserver.com", "mail.easserver.com"); } catch (SecurityException e) { Log.w(TAG, "SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 6 |
MDM 4.0 |
User Scope |
Deprecated in API level 27
API to be called to notify other applications after changes are made to an account.
SecurityException | If caller does not have required permissions |
---|
This API is to be called whenever any changes are made to an account. The API enables all other applications that depend on the account to be informed if any changes are made to account parameters. |
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.deleteAccount( accountId); if(result){ Log.d(TAG,"deleting account succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account deletion. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"deleting account failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.deleteAccount( accountId); if(result){ Log.d(TAG,"deleting account succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account deletion. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"deleting account failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to enable or disable the Microsoft Exchange account setting for accepting all certificates.
acceptAllCertificates | true to enable, false to disable |
---|---|
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure whether Secure Sockets
Layer (SSL) transport should accept all certificates sent from the server when
connecting to it. The key to using this API is the enterprise Microsoft Exchange ActiveSync
account Id, which is obtained using getAccountId(String, String, String) .
A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setAcceptAllCertificates( true, accountId); if(result){ Log.d(TAG,"setAcceptAllCertificates succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG," setAcceptAllCertificates failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setAcceptAllCertificates( true, accountId); if(result){ Log.d(TAG,"setAcceptAllCertificates succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG," setAcceptAllCertificates failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to change the account name displayed for the Microsoft Exchange account.
accountName | Account name String |
---|---|
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure the user-readable
name associated with a Microsoft Exchange ActiveSync account. The key to using this API is the
enterprise Microsoft Exchange ActiveSync account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setAccountName( "MytestAccount",accountId); if(result){ Log.d(TAG,"setAccountName succeeded!"); // Administrator needs to call sendAccountsChangedBroadcast() API // to notify about the Microsoft Exchange account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setAccountName failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setAccountName( "MytestAccount",accountId); if(result){ Log.d(TAG,"setAccountName succeeded!"); // Administrator needs to call sendAccountsChangedBroadcast() API // to notify about the Microsoft Exchange account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setAccountName failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to enable or disable the Microsoft Exchange account setting 'Always Vibrate On Email Notification'.
enable | true to enable, false to disable |
---|---|
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administration can use this API to remotely configure whether the device
should always vibrate when a new email is received. The key to using
this API is the enterprise Microsoft Exchange ActiveSync account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy. setAlwaysVibrateOnEmailNotification(true, accountId); if(result){ Log.d(TAG,"setAlwaysVibrateOnEmailNotification succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setAlwaysVibrateOnEmailNotification failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy. setAlwaysVibrateOnEmailNotification(true, accountId); if(result){ Log.d(TAG,"setAlwaysVibrateOnEmailNotification succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setAlwaysVibrateOnEmailNotification failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to set a given account as the default.
accId | Id of account to be set as default |
---|
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to set a particular account as the default
account. The key to using this API is the enterprise Microsoft Exchange ActiveSync a
ccount Id, which is obtained using getAccountId(String, String, String) . A
user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setAsDefaultAccount( accountId); if(result){ Log.d(TAG,"setAsDefaultAccount succeeded!"); }else{ Log.d(TAG,"setAsDefaultAccount failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setAsDefaultAccount( accountId); if(result){ Log.d(TAG,"setAsDefaultAccount succeeded!"); }else{ Log.d(TAG,"setAsDefaultAccount failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has protection level of signature. |
API level 2 |
MDM 2.0 |
User Scope |
Deprecated in API level 27
API to set the certificate for an account.
certData | Certificate binary |
---|---|
password | Certificate password to extract information |
accId | Account to be set |
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely install the authentication
certificate for a Microsoft Exchange ActiveSync account to be used by the client during
Secure Sockets Layer (SSL) client authentication. The key to using this API is the
enterprise Microsoft Exchange ActiveSync account Id, which is obtained using
getAccountId(String, String, String) . A user cannot change this parameter.
The administrator can determine the status of certificate installation by
using the intent ACTION_CBA_INSTALL_STATUS .
|
byte[] read2array(String fileName) throws IOException { File file = new File(fileName); FileInputStream is = null; byte[] bytes = null; try { is = new FileInputStream(file); } catch (FileNotFoundException e) { e.printStackTrace(); } if (null != is) { // Get the size of the file long length = file.length(); if (length > Integer.MAX_VALUE) { throw new IOException("The file is too big"); } // Create the byte array to hold the data bytes = new byte[(int) length]; // Read in the bytes int offset = 0; int numRead = 0; while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) { offset += numRead; } // Ensure all the bytes have been read in if (offset < bytes.length) { throw new IOException("The file was not completely read: " + file.getName()); } // Close the input stream, all file contents are in the bytes variable is.close(); } return bytes; } void setAccountCertificate() { long accountId = -1; byte[] certData = null; try { certData = read2array(certificatePath); } catch (IOException e) { e.printStackTrace(); } EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm. getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); exchangeAccountPolicy.setClientAuthCert(certData, "password245", accountId); } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } } |
byte[] read2array(String fileName) throws IOException { File file = new File(fileName); FileInputStream is = null; byte[] bytes = null; try { is = new FileInputStream(file); } catch (FileNotFoundException e) { e.printStackTrace(); } if (null != is) { // Get the size of the file long length = file.length(); if (length > Integer.MAX_VALUE) { throw new IOException("The file is too big"); } // Create the byte array to hold the data bytes = new byte[(int) length]; // Read in the bytes int offset = 0; int numRead = 0; while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) { offset += numRead; } // Ensure all the bytes have been read in if (offset < bytes.length) { throw new IOException("The file was not completely read: " + file.getName()); } // Close the input stream, all file contents are in the bytes variable is.close(); } return bytes; } void setAccountCertificate() { long accountId = -1; byte[] certData = null; try { certData = read2array(certificatePath); } catch (IOException e) { e.printStackTrace(); } // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); exchangeAccountPolicy.setClientAuthCert(certData, "password245", accountId); } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to select the types of personal information management (PIM) items (contacts, calendar, tasks, notes) to sync on the account.
syncCalendar | syncCalendar = true , account syncs calendar information
syncCalendar = false , account does not sync calendar information |
---|---|
syncContacts | syncContacts = true , account syncs contact information
syncContacts = false , account does not sync contact information |
syncTasks | syncTasks = true , account syncs tasks information
syncTasks = false , account does not sync tasks information |
syncNotes | syncNotes = true , account syncs notes information
syncNotes = false , account does not sync notes information
NOTE: Notes syncing is not supported yet. |
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure the items that need
to be synced for the Microsoft Exchange ActiveSync account. The key to using this API
is the managed Microsoft Exchange ActiveSync account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setDataSyncs(true, true,false, false,accountId); if(result){ Log.d(TAG,"setDataSyncs succeeded!"); }else{ Log.d(TAG," setDataSyncs failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setDataSyncs(true, true,false, false,accountId); if(result){ Log.d(TAG,"setDataSyncs succeeded!"); }else{ Log.d(TAG," setDataSyncs failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 2 |
MDM 2.0 |
User Scope |
Deprecated in API level 27
API to enforce or reset a certificate alias used for S/MIME messages for specific Exchange account. The user is not allowed to use another certificate alias for that Exchange account.
Note: Only the administrator owner of S/MIME policies is allowed to make changes.
accId | Exchange account Id |
---|---|
alias | Certificate alias to set, null to reset |
type | Operation type either ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT or ENFORCE_SMIME_ALIAS_TYPE_SIGN |
true
if success, else false
. If true
, result will be sent via intent ACTION_ENFORCE_SMIME_ALIAS_RESULT
.SecurityException | If caller does not have required permissions |
---|
Administrator can use this API to enforce or reset (if a certificate alias has already been enforced by administrator) a certificate alias
used for S/MIME messages for specific Exchange account, either for Signature or Encryption operations. MDM framework will broadcast intent
with action ACTION_ENFORCE_SMIME_ALIAS_RESULT with EXTRA_ENFORCE_SMIME_ALIAS_TYPE , EXTRA_ACCOUNT_ID and
EXTRA_SMIME_RESULT as extras upon calling this API.NOTE 1: S/MIME certificate must be installed either in Client Certificate Manager (CCM) keystore or KEYSTORE_FOR_VPN_AND_APPS before calling this API.
Please refer either to CCM APIs (KNOX Premium SDK) or
installCertificateToKeystore(String, byte[], String, String, int)
for further details on how to install a certificate to those keystores, respectively. In case same alias is present on both keystores, the certificate at
CCM will be enforced, taking precedence over the one installed at VPN and APPS keystore.NOTE 2: In MDM 5.4, certificates from CCM keystore only is supported by this API. Certificates from VPN and APPS keystore are also supported by this API from MDM 5.4.1. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; String alias = "test"; int type = 1; // ExchangeAccountPolicy.ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT; try { boolean ret = exchangeAccountPolicy.setForceSMIMECertificateAlias(accId, alias, type); } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; String alias = "test"; int type = 1; // ExchangeAccountPolicy.ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT; try { boolean ret = exchangeAccountPolicy.setForceSMIMECertificateAlias(accId, alias, type); } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 15 |
MDM 5.4 |
User Scope |
Deprecated in API level 27
API to enforce or reset a certificate alias used for S/MIME messages for specific Exchange account. The user is not allowed to use another certificate alias for that Exchange account.
Note: Only the administrator owner of S/MIME policies is allowed to make changes.
accId | Exchange account Id |
---|---|
storageName | Credential storage name. Passing null or an empty String value will behave
same as calling setForceSMIMECertificateAlias(long, String, int) |
alias | Certificate alias to set, null to reset |
type | Operation type either ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT or ENFORCE_SMIME_ALIAS_TYPE_SIGN |
true
if success, else false
. If true
, result will be sent via intent ACTION_ENFORCE_SMIME_ALIAS_RESULT
.SecurityException | If caller does not have required permissions |
---|
Administrator can use this API to enforce or reset (if a certificate alias has already been enforced by administrator) a certificate alias
used for S/MIME messages for specific Exchange account, either for Signature or Encryption operations. MDM framework will broadcast intent
with action ACTION_ENFORCE_SMIME_ALIAS_RESULT with EXTRA_ENFORCE_SMIME_ALIAS_TYPE , EXTRA_ACCOUNT_ID and
EXTRA_SMIME_RESULT as extras upon calling this API.S/MIME certificate must be installed in the storage passed as parameter in storageName . In order to see
how to install certificates in such credential storage, please refer to Universal Credential Manager (UCM) DEV guide.
Passing null or an empty String value at storageName parameter will behave the same as calling
setForceSMIMECertificateAlias(long, String, int) . In this case, please refer to notes at that API
on which keystore will be used to retrieve alias. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy();
long accId = 1;
String alias = "test";
int type = 1; // ExchangeAccountPolicy.ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT;
try {
// Please refer to UCM DEV guide to see how to retrieve |
// When you create container successfully, containerID will be returned via intent.
// Use this containerID in below API.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy();
long accId = 1;
String alias = "test";
int type = 1; // ExchangeAccountPolicy.ENFORCE_SMIME_ALIAS_TYPE_ENCRYPT;
try {
// Please refer to UCM DEV guide to see how to retrieve |
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a
protection level of signature. Depending on the Credential Storage type identified by certificateStorageName parameter, a new permission will
also be enforced. System Credential Storages will check for
'com.samsung.android.knox.permission.KNOX_UCM_ESE_MGMT' permission,
while non-system ones check for
'com.samsung.android.knox.permission.KNOX_UCM_OTHER_MGMT' permission.
Please refer to Universal Credential Manager (UCM) DEV guide
in order to have more details of how to get these new
permissions. |
API level 19 |
MDM 5.6 |
User Scope |
Deprecated in API level 27
API to set maximum attachment size allowed for Exchange accounts. (byte)
size | vale to set maximum attachment size of Exchange accounts. |
---|---|
accId | The exchange account id to set maximum attachment size. |
true
if successful, false
otherwiseSecurityException | If caller does not have required permissions |
---|
An administrator can use this API to set maximum attachment size allowed for Exchange accounts. (byte) |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.setIncomingAttachmentsSize(1000,accId); if (true == enable) { // administrator set maximum attachment size of Exchange accounts as 1000 byte. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.setIncomingAttachmentsSize(1000,accId); if (true == enable) { // administrator set maximum attachment size of Exchange accounts as 1000 byte. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to set maximum calendar age allowed for Exchange accounts.
maxage | All(value 0), 2 weeks(value 4), 1 months(value 5), 3 months(value 6), 6 months (value 7) |
---|---|
accId | The exchange account id to set maximum Calendar sync period. |
true
if successful, false
otherwiseSecurityException | If caller does not have required permissions |
---|
An administrator can use this API to set maximum calendar age allowed for Exchange accounts. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.setMaxCalendarAgeFilter(4,accId); if (true == enable) { // administrator set maximum calendar age of Exchange accounts as 6 months. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.setMaxCalendarAgeFilter(4,accId); if (true == enable) { // administrator set maximum calendar age of Exchange accounts as 6 months. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to set maximum Email age of Exchange accounts.
maxage | All(int value 0), 1 day (int value 1), 3 day(int value 2), 1 week (int value 3), 2 weeks(int value 4), 1 months(int value 5). |
---|---|
accId | The exchange account id to set maximum Email sync period. |
true
if successful, false
otherwiseSecurityException | If caller does not have required permissions |
---|
An administrator can use this API to set maximum Email age of Exchange accounts. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.setMaxEmailAgeFilter(4,accId); if (true == enable) { // administrator set maximum Email age of Exchange accounts as 2 weeks. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { boolean enable = exchangeAccountPolicy.setMaxEmailAgeFilter(4,accId); if (true == enable) { // administrator set maximum Email age of Exchange accounts as 2 weeks. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to set maximum Email Body Truncation size of Exchange accounts. (kbyte)
size | value to set maximum Email Body Truncation size of Exchange accounts. (kbyte) |
---|---|
accId | The exchange account id to set maximum Email Body Truncation Size. |
true
if successful, false
otherwiseSecurityException | If caller does not have required permissions |
---|
An administrator can use this API to set maximum Email Body Truncation size of Exchange accounts. (kbyte) |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.setMaxEmailBodyTruncationSize(20,accId); if (true == enable) { // administrator set maximum Email Body Truncation size of Exchange accounts as 20 kb. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { boolean enable = exchangeAccountPolicy.setMaxEmailBodyTruncationSize(20,accId); if (true == enable) { // administrator set maximum Email Body Truncation size of Exchange accounts as 20 kb. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to set maximum Email HTML Body Truncation size of Exchange accounts. (kbyte)
size | value to set maximum Email HTML Body Truncation size of Exchange accounts. (kbyte) |
---|---|
accId | The exchange account id to set maximum Email HTML Body Truncation Size. |
true
if successful, false
otherwiseSecurityException | If caller does not have required permissions |
---|
An administrator can use this API to set maximum Email HTML Body Truncation size of Exchange accounts. (kbyte) |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.setMaxEmailBodyTruncationSize(20,accId); if (true == enable) { // administrator set maximum Email HTML Body Truncation size of Exchange accounts as 20 kb. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { boolean enable = exchangeAccountPolicy.setMaxEmailBodyTruncationSize(20,accId); if (true == enable) { // administrator set maximum Email HTML Body Truncation size of Exchange accounts as 20 kb. } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 11 |
MDM 5.0 |
User Scope |
Deprecated in API level 27
API to change the password of the Microsoft Exchange account.
password | Password String |
---|---|
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure the password of the
Microsoft Exchange ActiveSync account. The key to using this API is the enterprise
Microsoft Exchange ActiveSync account Id, which is obtained using getAccountId(String, String, String) .
A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setPassword("password@123", accountId); if(result){ Log.d(TAG,"setPassword succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setPassword failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setPassword("password@123", accountId); if(result){ Log.d(TAG,"setPassword succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setPassword failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to change the number of previous days to sync email in a Microsoft Exchange account.
pastDaysToSync | 1 day (int value 1), 3 days(int value 2), 1 week (int value 3), 2 weeks (int value 4), 1 month (int value 5) |
---|---|
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure the number of previous days
that email should be synced for a Microsoft Exchange ActiveSync account. The key to using
this API is the managed Microsoft Exchange ActiveSync account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setPastDaysToSync(2, accountId); if(result){ Log.d(TAG,"setPastDaysToSync succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setPastDaysToSync failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setPastDaysToSync(2, accountId); if(result){ Log.d(TAG,"setPastDaysToSync succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setPastDaysToSync failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to require S/MIME certificate to encrypt messages for a specific exchange account.
Note: Only the administrator owner of S/MIME policies is allowed to make changes.
accId | The exchange account id. |
---|---|
enable | true to enable encrypted S/MIME messages for the given account,
false to disable encrypted S/MIME messages. |
true
on success, false
on failure.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to require encrypted S/MIME messages for an exchange account. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); long accId = 1; try { boolean result = exchangeAccountPolicy.setRequireEncryptedSMIMEMessages(accId, true); if (true == result) { // encrypted S/MIME messages are now required for this account } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); long accId = 1; try { boolean result = exchangeAccountPolicy.setRequireEncryptedSMIMEMessages(accId, true); if (true == result) { // encrypted S/MIME messages are now required for this account } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 6 |
MDM 4.0 |
User Scope |
Deprecated in API level 27
API to set whether S/MIME certificate is required for signing messages for an specified account.
Note: Only the administrator owner of S/MIME policies is allowed to make changes.
accId | The exchange account id to be configured. |
---|---|
enable | true to enable signed S/MIME messages for the given account.
false to disable signed S/MIME messages. |
true
on success, false
on failure.SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to require signed S/MIME messages for an exchange account. |
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { boolean result = exchangeAccountPolicy.setRequireSignedSMIMEMessages(accId, true); if (true == result) { // signed S/MIME messages are now required for this account } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
// When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { boolean result = exchangeAccountPolicy.setRequireSignedSMIMEMessages(accId, true); if (true == result) { // signed S/MIME messages are now required for this account } } catch (SecurityException e) { Log.w(TAG,"SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 6 |
MDM 4.0 |
User Scope |
Deprecated in API level 27
API to enable or disable the Secure Sockets Layer (SSL) setting of the Microsoft Exchange account.
enableSSL | true to enable, false to disable |
---|---|
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure whether SSL
transport should be used when connecting with the server. The key to using
this API is the managed Microsoft Exchange ActiveSync account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setSSL(true, accountId); if(result){ Log.d(TAG,"setSSL succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setSSL failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setSSL(true, accountId); if(result){ Log.d(TAG,"setSSL succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setSSL failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to change the user signature in the Microsoft Exchange account.
signature | Signature String |
---|---|
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure the user signature,
which appears at the bottom of every outgoing email, in a Microsoft Exchange
ActiveSync account. The key to using this API is the enterprise Microsoft Exchange ActiveSync
account Id, which is obtained using getAccountId(String, String, String) . A user
can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setSignature( "myTestSignature",accountId); if(result){ Log.d(TAG,"setSignature succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setSignature failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setSignature( "myTestSignature",accountId); if(result){ Log.d(TAG,"setSignature succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG,"setSignature failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 1 |
MDM 1.0 |
User Scope |
Deprecated in API level 27
API to set the sync interval peak days and peak timings of the account.
peakDays | Peak days for sync schedule, put decimal number after calculating binary number. Sequence of binary number - SAT,FRI,THU,WED,TUE,MON,SUN eg: 62 (0x3e) for Fri|Thu|Wed|Tue|Mon (0111110) 73 (0x49) for Sat|Wed|Sun (1001001) 66 (0x42) for Sat|Mon (1000010) |
---|---|
peakStartMinute | Peak start time in minutes. For example: 8AM 8hr x 60 = 480 9AM 9hr x 60 = 540 |
peakEndMinute | Peak end time in minutes. For example: 5PM 17hr x 60 = 1020 6PM 18hr x 60 = 1080 |
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure the sync interval peak
timings for the Microsoft Exchange ActiveSync account. The key to using this API is the enterprise
Microsoft Exchange ActiveSync account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setSyncPeakTimings(62, 480, 1020, accountId); if(result){ Log.d(TAG,"setSyncPeakTimings succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG," setSyncPeakTimings failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setSyncPeakTimings(62, 480, 1020, accountId); if(result){ Log.d(TAG,"setSyncPeakTimings succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG," setSyncPeakTimings failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 2 |
MDM 2.0 |
User Scope |
Deprecated in API level 27
API to change the number of previous days to sync the account.
peakSyncSchedule | Frequency to sync email during peak time
|
---|---|
offPeakSyncSchedule | Frequency to sync email during off-peak time
|
roamingSyncSchedule | 0 - Manual 1 - Use sync settings |
accId | Id of account to be changed |
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to remotely configure the advanced sync schedule
of the Microsoft Exchange ActiveSync account. The key to using this API is the enterprise
Microsoft Exchange ActiveSyncaccount Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1; EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); ExchangeAccountPolicy exchangeAccountPolicy = edm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setSyncSchedules(-2, 60, 0, accountId); if(result){ Log.d(TAG,"setSyncSchedules succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG," setSyncSchedules failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
long accountId = -1; // When you create container successfully, containerID will be returned via intent. // Use this containerID in below API. EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context); KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID); ExchangeAccountPolicy exchangeAccountPolicy = kcm.getExchangeAccountPolicy(); try { accountId = exchangeAccountPolicy.getAccountId("easDomain", "testeasid","easserver.com"); boolean result = exchangeAccountPolicy.setSyncSchedules(-2, 60, 0, accountId); if(result){ Log.d(TAG,"setSyncSchedules succeeded!"); // Administrator need to call sendAccountsChangedBroadcast() API // to notify the exchange(EAS) account changes. exchangeAccountPolicy.sendAccountsChangedBroadcast(); }else{ Log.d(TAG," setSyncSchedules failed."); } } catch(SecurityException e) { Log.w(TAG,"SecurityException: "+e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EXCHANGE" permission which has a protection level of signature. |
API level 2 |
MDM 2.0 |
User Scope |