Since: API level 5
public class

EmailPolicy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.accounts.EmailPolicy

Deprecated in API level 27

Class Overview

This class provides APIs to control email application-related settings.

Since
API level 5
MDM 3.0

Summary

Public Constructors
EmailPolicy()
Public Methods
boolean allowAccountAddition(boolean allowed)
Deprecated in API level 27
boolean allowEmailSettingsChange(boolean allow, long accId)
Deprecated in API level 27
boolean getAllowEmailForwarding(String emailAddress)
Deprecated in API level 27
boolean getAllowHtmlEmail(String emailAddress)
Deprecated in API level 27
boolean isAccountAdditionAllowed()
Deprecated in API level 27
boolean isEmailNotificationsEnabled(long accId)
Deprecated in API level 27
boolean isEmailSettingsChangeAllowed(long accId)
Deprecated in API level 27
boolean setAllowEmailForwarding(String emailAddress, boolean allow)
Deprecated in API level 27
boolean setAllowHtmlEmail(String emailAddress, boolean allow)
Deprecated in API level 27
boolean setEmailNotificationsState(boolean enable, long accId)
Deprecated in API level 27
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public EmailPolicy ()

Since: API level 5

Public Methods

public boolean allowAccountAddition (boolean allowed)

Since: API level 6

Deprecated in API level 27

API to restrict user from adding any new email accounts.

Parameters
allowed true if user is allowed to add new email account, else false.
Returns
  • true if administrator preference is saved, else false.
Throws
SecurityException If caller does not have required permissions
Usage
Administrator can use this API to restrict user from adding any new email accounts. The administrator can still add an account using add new account API.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EMAIL" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean allowEmailSettingsChange (boolean allow, long accId)

Since: API level 11

Deprecated in API level 27

API to allow or disallow user from changing an Email account settings.

Parameters
allow true to allow changing setting of a Email account, false to disallow.
accId The Email account id to change setting of a Email account.
Returns
  • true if success else false
Usage
An administrator can use this API to allow or disallow user from changing settings of a Email account.
 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 EmailPolicy emailPolicy = edm.getEmailPolicy();
 long accId = 1;
 try {
          // disallow changing settings of a Email account
          emailPolicy.allowEmailSettingsChange(false,accId);
     }
 } catch (SecurityException e) {
     Log.w(TAG,"SecurityException: " + e);
 }
 
For Container:
 // 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);
 EmailPolicy emailPolicy = kcm.getEmailPolicy();
 long accId = 1;
 try {
          // disallow changing settings of a Email account
          emailPolicy.allowEmailSettingsChange(false,accId);
     }
 } 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_EMAIL" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope

public boolean getAllowEmailForwarding (String emailAddress)

Since: API level 5

Deprecated in API level 27

API to query whether the native email application is allowed to show an option to forward emails using another email account.

Parameters
emailAddress The email address of the account that can be used for forwarding.
Returns
  • true on email forwarding allowed, else false.
Usage
If the email application is configured with more than one email account, the application provides the user with an option to choose an account to use for forwarding. For instance, a user has configured two email accounts, E1 and E2, and receives an email on E1 account. The email application provides the user an option to forward from either E1 or E2. An administrator can use this API to check whether the email forwarding option is allowed for a particular account. Please note that Microsoft Exchange ActiveSync email forwarding through other account functionality may be restricted in devices for which Verizon is the carrier.

Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public boolean getAllowHtmlEmail (String emailAddress)

Since: API level 6

Deprecated in API level 27

API to query whether the native email application is allowed to use HTML format to display emails.

Parameters
emailAddress The email address of the account.
Returns
  • true if HTML format display is allowed, else false.
Usage

An administrator can use this API to query if email applications are configured to use HTML format when displaying emails. The enterprise can take appropriate actions based on enterprise policy depending on the setting.

Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean isAccountAdditionAllowed ()

Since: API level 6

Deprecated in API level 27

API to check if user is allowed to add email accounts.

Returns
  • true if user is allowed to add email accounts.
Usage
An administrator can use this API to check if the user is allowed to add new email accounts.

Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean isEmailNotificationsEnabled (long accId)

Since: API level 11

Deprecated in API level 27

API to get enable notification of a Email account.

Parameters
accId The Email account id to get notification of a Email account.
Returns
  • notification of a Email account.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to get enable notification of a Email account.
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope

public boolean isEmailSettingsChangeAllowed (long accId)

Since: API level 11

Deprecated in API level 27

API to check whether Email account settings change is allowed or not.

Parameters
accId The Email account id to get changing setting of a Email account.
Returns
  • true if allowed else false.
Throws
SecurityException If caller does not have required permissions
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope

public boolean setAllowEmailForwarding (String emailAddress, boolean allow)

Since: API level 5

Deprecated in API level 27

API to prevent the forwarding of emails received by a given email address.

Parameters
emailAddress the email address of the account from which forwarding is allowed or not allowed.
allow true to allow email forwarding option, false to disallow email forwarding option.
Returns
  • true if email forwarding is successfully allowed/disallowed, else false.
Throws
SecurityException If caller does not have required permissions
Usage
If the native email application is configured with more than one email account, the email application provides the user with an option to choose an account to use for forwarding. For instance, an user has configured two email accounts, E1 and E2, and receives an email on account E1. The native email application provides the user an option to forward from either E1 or E2. An administrator can use this API to turn off the email forwarding option for a specific account (ex. E1) so that emails cannot be forwarded using that account (E1) from other accounts. This policy works only with the native Android email application. Note that Microsoft Exchange ActiveSync email forwarding through other account functionality may be restricted in devices for which Verizon is the carrier.

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

public boolean setAllowHtmlEmail (String emailAddress, boolean allow)

Since: API level 6

Deprecated in API level 27

API to set whether the native email application is allowed to use HTML format for emails.

Parameters
emailAddress the email address of the account for which HTML format should be configured.
allow true to allow HTML format, false to disallow HTML format.
Returns
  • true if HTML format display is successfully enabled or disabled, else false.
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to allow or disallow the native email application using HTML format when displaying emails. This policy works only Microsoft Exchange ActiveSync Account.

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EMAIL" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean setEmailNotificationsState (boolean enable, long accId)

Since: API level 11

Deprecated in API level 27

API to set enable or disable notification of a Email account.

Parameters
enable value set enable notification of a Email account.
accId The Email account id to change notification of a Email account.
Returns
  • true if success
Usage
An administrator can use this API to set enable or disable notification of a Email account.
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EMAIL" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope