Deprecated
in API level 27
Class Overview
This class provides APIs to create and delete e-mail accounts and to control
Internet Access Message Protocol (IMAP) or Post Office Protocol (POP) email account-related settings.
Summary
Public Methods |
long
|
addNewAccount(EmailAccount account)
Deprecated
in API level 27
|
boolean
|
deleteAccount(long accId)
Deprecated
in API level 27
|
Account
|
getAccountDetails(long accId)
Deprecated
in API level 27
|
long
|
getAccountId(String login, String serverAddress, String protocol)
Deprecated
in API level 27
|
Account[]
|
getAllEmailAccounts()
Deprecated
in API level 27
|
void
|
removePendingAccount(String emailAddress, String incomingProtocol, String incomingServerAddress)
Deprecated
in API level 27
|
void
|
sendAccountsChangedBroadcast()
Deprecated
in API level 27
|
boolean
|
setAccountName(String accountName, long accId)
Deprecated
in API level 27
|
boolean
|
setAlwaysVibrateOnEmailNotification(boolean enable, long accId)
Deprecated
in API level 27
|
boolean
|
setAsDefaultAccount(long accId)
Deprecated
in API level 27
|
boolean
|
setInComingProtocol(String protocol, long accId)
Deprecated
in API level 27
|
boolean
|
setInComingServerAcceptAllCertificates(boolean acceptAllCertificates, long accId)
Deprecated
in API level 27
|
long
|
setInComingServerAddress(String serverAddress, long accId)
Deprecated
in API level 27
|
boolean
|
setInComingServerPassword(String password, long accId)
Deprecated
in API level 27
|
boolean
|
setInComingServerPort(int port, long accId)
Deprecated
in API level 27
|
boolean
|
setInComingServerSSL(boolean enableSSL, long accId)
Deprecated
in API level 27
|
boolean
|
setOutGoingServerAcceptAllCertificates(boolean acceptAllCertificates, long accId)
Deprecated
in API level 27
|
long
|
setOutGoingServerAddress(String serverAddress, long accId)
Deprecated
in API level 27
|
boolean
|
setOutGoingServerPassword(String password, long accId)
Deprecated
in API level 27
|
boolean
|
setOutGoingServerPort(int port, long accId)
Deprecated
in API level 27
|
boolean
|
setOutGoingServerSSL(boolean enableSSL, long accId)
Deprecated
in API level 27
|
boolean
|
setSenderName(String senderName, long accId)
Deprecated
in API level 27
|
boolean
|
setSignature(String signature, long accId)
Deprecated
in API level 27
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Constants
public
static
final
String
ACCOUNT_TYPE_IMAP
Since: API level 6
Key represents "IMAP" account type
Constant Value:
"imap"
public
static
final
String
ACCOUNT_TYPE_POP3
Since: API level 6
Key represents "POP3" account type
Constant Value:
"pop3"
public
static
final
String
ACTION_EMAIL_ACCOUNT_ADD_RESULT
Since: API level 6
Broadcast Action: To notify the administrator about account create/update operations status, which is sent
after validation of accounts setting. 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_INCOMING_PROTOCOL
EXTRA_EMAIL_ADDRESS
EXTRA_INCOMING_SERVER_ADDRESS
EXTRA_ACCOUNT_ID
Permission
The use of this intent requires the user to have the
"com.samsung.android.knox.permission.KNOX_EMAIL" permission
which has a protection level of signature. |
Constant Value:
"com.samsung.android.knox.intent.action.EMAIL_ACCOUNT_ADD_RESULT"
public
static
final
String
ACTION_EMAIL_ACCOUNT_DELETE_RESULT
Since: API level 6
Permission
The use of this intent requires the user to have the
"com.samsung.android.knox.permission.KNOX_EMAIL" permission
which has a protection level of signature. |
Constant Value:
"com.samsung.android.knox.intent.action.EMAIL_ACCOUNT_DELETE_RESULT"
public
static
final
String
EXTRA_ACCOUNT_ID
Since: API level 6
The lookup key for long object. Retrieve with getLongExtra(String, long).
Account Id in email database or -1 in case of account creation, account update,
and deletion of nonvalidating accounts.
Constant Value:
"com.samsung.android.knox.intent.extra.ACCOUNT_ID"
public
static
final
String
EXTRA_EMAIL_ADDRESS
Since: API level 6
The lookup key for String
object. Retrieve with getStringExtra(String).
Account email address used to identify account
Constant Value:
"com.samsung.android.knox.intent.extra.EMAIL_ADDRESS"
public
static
final
String
EXTRA_INCOMING_PROTOCOL
Since: API level 6
The lookup key for String
object. Retrieve with getStringExtra(String).
Account protocol "pop3" or "imap" used to identify account type.
Constant Value:
"com.samsung.android.knox.intent.extra.INCOMING_PROTOCOL"
public
static
final
String
EXTRA_INCOMING_SERVER_ADDRESS
Since: API level 6
The lookup key for String
object. Retrieve with getStringExtra(String).
Account incoming server host address used to identify account
Constant Value:
"com.samsung.android.knox.intent.extra.INCOMING_SERVER_ADDRESS"
public
static
final
String
EXTRA_RESULT
Since: API level 6
The lookup key for integer object. Retrieve with getIntExtra(String, int).
Status for account creation/update/delete
- Value 0 - Success
- Value 1 - Activation error for setup result intent or fail due to delete result intent
- Value 2 - Authentication error
- Value 3 - IO error
- Value 7 - Error when saving account to database
- Value 8 - Other errors
Constant Value:
"com.samsung.android.knox.intent.extra.RESULT"
Public Methods
public
long
addNewAccount
(EmailAccount account)
Deprecated
in API level 27
API to add a new email account.
Parameters
account
| EmailAccount class for email account |
Returns
- On success, valid account Id if Android version is less than 4.0 else
0 for Android version 4.0 onwards.
On failure, -1.
Usage
An administrator can use this API to remotely configure an email account
on the user's device without user interaction. A user can change most of these
settings.
The administrator can register ACTION_EMAIL_ACCOUNT_ADD_RESULT
intent to receive account creation status and create account's Id.
The administrator can use removePendingAccount(String, String, String)
to delete nonvalidated pending accounts.
NOTE:
On For Android version 4.0 onward, an account is not added until the user/administrator launches
the email application. After launch, the email application processes account creation
and is ready to use, retrieve information, and update.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.addNewAccount(new EmailAccount(
"testemail@gmail.com","pop3","pop.gmail.com", 995,
"testemail@gmail.com", null,"smtp", "smtp.gmail.com",465,
"testemail@gmail.com",null));
if(accountId >= 0){
Log.d(TAG," Adding a new email account has succeeded!");
// Administrator needs to call sendAccountsChangedBroadcast() API
// to notify regarding email account addition.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Adding a new email account failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.addNewAccount(new EmailAccount(
"testemail@gmail.com","pop3","pop.gmail.com", 995,
"testemail@gmail.com", null,"smtp", "smtp.gmail.com",465,
"testemail@gmail.com",null));
if(accountId >= 0){
Log.d(TAG," Adding a new email account has succeeded!");
// Administrator needs to call sendAccountsChangedBroadcast() API
// to notify regarding email account addition.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Adding a new email account failed.");
}
} 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. |
public
boolean
deleteAccount
(long accId)
Deprecated
in API level 27
API to delete an email account.
Parameters
accId
| Id of account to be deleted |
Returns
true
if the account successfully deleted, else returns false
Usage
An administrator can use this API to remotely delete an email account and
all related data. The key to using this API is the enterprise account Id,
which is obtained using getAccountId(String, String, String) .
Account deletion occurs without user interaction.
The administrator can register ACTION_EMAIL_ACCOUNT_DELETE_RESULT
intent to receive account deletion status.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.deleteAccount(accountId);
if(result){
Log.d(TAG," Deleting account succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account deletion.
mEmailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Deleting account failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.deleteAccount(accountId);
if(result){
Log.d(TAG," Deleting account succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account deletion.
mEmailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Deleting account failed.");
}
} 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. |
public
Account
getAccountDetails
(long accId)
Deprecated
in API level 27
API to get the details of an account based on the account Id.
Parameters
accId
| Id of the account containing the details to be queried |
Returns
Account
object filled with all account details.
Usage
An administrator can use this utility API to obtain the account details
of a particular email account. The key to using this API is the
managed account Id, which is obtained using
getAccountId(String, String, String) .
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
Account account = emailAccountPolicy.getAccountDetails(accountId);
if(account != null){
Log.d(TAG," Getting account details succeeded!");
}else{
Log.d(TAG," Getting account details failed/null.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
Account account = emailAccountPolicy.getAccountDetails(accountId);
if(account != null){
Log.d(TAG," Getting account details succeeded!");
}else{
Log.d(TAG," Getting account details failed/null.");
}
} 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. |
public
long
getAccountId
(String login, String serverAddress, String protocol)
Deprecated
in API level 27
API to obtain an account Id based on the account login, server address, and protocol.
Parameters
login
| Incoming or outgoing username/login |
serverAddress
| Incoming or outgoing server address |
protocol
| Incoming or outgoing server protocol ("pop3" or "imap") |
Returns
- Account Id that has the unique combination of login, protocol, and server
address on success, else -1
Usage
An administrator can use this utility API to obtain the account Id of a
particular email account. Any email account is uniquely represented by
a combination of the login, server address, and protocol.
All parameters for this API are case sensitive.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
long accountId = emailAccountPolicy.getAccountId(
"testemail@gmail.com","pop.gmail.com","pop3");
if(accountId >0){
Log.d(TAG," Get account Id is valid!");
}else{
Log.d(TAG," Get account Id is invalid.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
long accountId = emailAccountPolicy.getAccountId(
"testemail@gmail.com","pop.gmail.com","pop3");
if(accountId >0){
Log.d(TAG," Get account Id is valid!");
}else{
Log.d(TAG," Get account Id is invalid.");
}
} 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. |
public
Account[]
getAllEmailAccounts
()
Deprecated
in API level 27
API to get all email account information as a list.
Returns
Account
object array filled with all account details if any
email accounts exist else account object is null
Usage
An administrator can use this API to get all existing email accounts
on the device.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
Account[] account = emailAccountPolicy.getAllEmailAccounts();
if(account! =null){
Log.d(TAG," Return email accounts information succeeded!");
}else{
Log.d(TAG," Return email accounts information failed/null.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
Account[] account = emailAccountPolicy.getAllEmailAccounts();
if(account! =null){
Log.d(TAG," Return email accounts information succeeded!");
}else{
Log.d(TAG," Return email accounts information failed/null.");
}
} 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. |
public
void
removePendingAccount
(String emailAddress, String incomingProtocol, String incomingServerAddress)
Deprecated
in API level 27
API to remove account which is still pending creation.
Parameters
emailAddress
| Email Address of the account. |
incomingProtocol
| Incoming server protocol ("pop3" or "imap") |
incomingServerAddress
| Incoming server address |
Usage
Administrator can use this API to remove pending email account from
the device.
|
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
emailAccountPolicy.removePendingAccount("testemail@gmail.com", "pop3", "pop.gmail.com");
} 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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
emailAccountPolicy.removePendingAccount("testemail@gmail.com", "pop3", "pop.gmail.com");
} 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. |
public
void
sendAccountsChangedBroadcast
()
Deprecated
in API level 27
API for notifying other applications when email account changes are made.
Usage
This API enables all other applications that depend on the email
account to be informed if any changes are made to account parameters.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.deleteAccount(mAccountId);
if(result){
Log.d(TAG," Add/change/update to account succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account deletion.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Add/change/update to account failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.deleteAccount(mAccountId);
if(result){
Log.d(TAG," Add/change/update to account succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account deletion.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Add/change/update to account failed.");
}
} 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. |
public
boolean
setAccountName
(String accountName, long accId)
Deprecated
in API level 27
API to change the account name displayed for the email account.
Parameters
accountName
| Account name String
|
accId
| Id of account to be changed |
Returns
true
if successful, false
false
Usage
An administrator can use this API to remotely configure the user-readable
name associated with an email account. The key to using this API is the
enterprise account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setAccountName(
"testEmailAccountName", accountId);
if(result){
Log.d(TAG," Setting account name succeeded!");
// Admin/User need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Setting account name failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setAccountName(
"testEmailAccountName", accountId);
if(result){
Log.d(TAG," Setting account name succeeded!");
// Admin/User need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Setting account name failed.");
}
} 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. |
public
boolean
setAlwaysVibrateOnEmailNotification
(boolean enable, long accId)
Deprecated
in API level 27
API to enable or disable the email account setting 'Always Vibrate On Email Notification'.
Parameters
enable
| true to enable, false to disable |
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure whether the device
always vibrates when a new email is received. The key to using
this API is the managed account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result= emailAccountPolicy.setAlwaysVibrateOnEmailNotification
(true, accountId);
if(result){
Log.d(TAG," setAlwaysVibrateOnEmailNotification succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG,"setAlwaysVibrateOnEmailNotification failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result= emailAccountPolicy.setAlwaysVibrateOnEmailNotification
(true, accountId);
if(result){
Log.d(TAG," setAlwaysVibrateOnEmailNotification succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG,"setAlwaysVibrateOnEmailNotification failed.");
}
} 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. |
public
boolean
setAsDefaultAccount
(long accId)
Deprecated
in API level 27
API to set a given account as the default.
Parameters
accId
| Id of account to be set as default |
Returns
true
if successful, else false
Usage
An administrator can use this API to set a particular account as the
default account. The key to using this API is the enterprise account Id
which is obtained using getAccountId(String, String, String) .
A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setAsDefaultAccount(accountId);
if(result){
Log.d(TAG,"setAsDefaultAccount succeeded!");
}else{
Log.d(TAG," setAsDefaultAccount failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setAsDefaultAccount(accountId);
if(result){
Log.d(TAG,"setAsDefaultAccount succeeded!");
}else{
Log.d(TAG," setAsDefaultAccount failed.");
}
} 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 protection
level of signature. |
public
boolean
setInComingProtocol
(String protocol, long accId)
Deprecated
in API level 27
API to set email account incoming protocol.
Parameters
protocol
| Protocol as String
Example: pop3 or imap |
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure the incoming
protocol of the email account. The key to using this API is the managed
account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setInComingProtocol("pop3",
accountId);
if(result){
Log.d(TAG," setInComingProtocol succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setInComingProtocol failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setInComingProtocol("pop3",
accountId);
if(result){
Log.d(TAG," setInComingProtocol succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setInComingProtocol failed.");
}
} 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. |
public
boolean
setInComingServerAcceptAllCertificates
(boolean acceptAllCertificates, long accId)
Deprecated
in API level 27
API to enable or disable Secure Sockets Layer (SSL) accepting all certificates for incoming connections.
Parameters
acceptAllCertificates
| true to enable, false to disable |
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure whether SSL
accepts all certificates for incoming connections of an email account.
The key to using this API is the enterprise account Id, which is obtained
using getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result=emailAccountPolicy.
setInComingServerAcceptAllCertificates(true, accountId);
if(result){
Log.d(TAG,"setInComingServerAcceptAllCertificates succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG,"setInComingServerAcceptAllCertificates failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result=emailAccountPolicy.
setInComingServerAcceptAllCertificates(true, accountId);
if(result){
Log.d(TAG,"setInComingServerAcceptAllCertificates succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG,"setInComingServerAcceptAllCertificates failed.");
}
} 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. |
public
long
setInComingServerAddress
(String serverAddress, long accId)
Deprecated
in API level 27
API to set the incoming server address.
Parameters
serverAddress
| Incoming server address |
accId
| Id of account to be changed |
Returns
- valid account id if successful, else -1.
Usage
An administrator can use this API to remotely configure the incoming server
address of the email account. The key to using this API is the managed
email account Id, which is obtained using
getAccountId(String, String, String) . The user can
change this parameter.
NOTE: The account Id changes if this API call succeeds.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
long mNewAccId = emailAccountPolicy.setInComingServerAddress(
"pop.gmail.com", accountId);
if(mNewAccId >0){
Log.d(TAG," setInComingServerAddress succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
// if the base parameter of existing email account changes,the existing
// email account id will be deleted and a new email account will be
// created with different account id.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setInComingServerAddress failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
long mNewAccId = emailAccountPolicy.setInComingServerAddress(
"pop.gmail.com", accountId);
if(mNewAccId >0){
Log.d(TAG," setInComingServerAddress succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
// if the base parameter of existing email account changes,the existing
// email account id will be deleted and a new email account will be
// created with different account id.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setInComingServerAddress failed.");
}
} 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. |
public
boolean
setInComingServerPassword
(String password, long accId)
Deprecated
in API level 27
API to change the incoming server password.
Parameters
password
| Password String
|
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure the incoming
server password of the email account. The key to use this API is the
managed account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setInComingServerPassword
("password123", accountId);
if(result){
Log.d(TAG,"setInComingServerPassword succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setInComingServerPassword failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setInComingServerPassword
("password123", accountId);
if(result){
Log.d(TAG,"setInComingServerPassword succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setInComingServerPassword failed.");
}
} 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. |
public
boolean
setInComingServerPort
(int port, long accId)
Deprecated
in API level 27
API to set the incoming server port number.
Parameters
port
| Port number |
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure the incoming server
port for the email account. The key to using this API is the managed
account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setInComingServerPort(995,
accountId);
if(result){
Log.d(TAG," setInComingServerPort succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG,"setInComingServerPort failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setInComingServerPort(995,
accountId);
if(result){
Log.d(TAG," setInComingServerPort succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG,"setInComingServerPort failed.");
}
} 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. |
public
boolean
setInComingServerSSL
(boolean enableSSL, long accId)
Deprecated
in API level 27
API to enable or disable the email account setting for incoming server Secure Sockets Layer (SSL).
Parameters
enableSSL
| true to enable, false to disable |
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure whether SSL should
be used for incoming connections of the email account. The key to use
this API is the managed account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setInComingServerSSL(true,
accountId);
if(result){
Log.d(TAG," setInComingServerSSL succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setInComingServerSSL failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setInComingServerSSL(true,
accountId);
if(result){
Log.d(TAG," setInComingServerSSL succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setInComingServerSSL failed.");
}
} 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. |
public
boolean
setOutGoingServerAcceptAllCertificates
(boolean acceptAllCertificates, long accId)
Deprecated
in API level 27
API to enable or disable the outgoing server accepting all certificates.
Parameters
acceptAllCertificates
| true to enable, false to disable |
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure whether Secure Sockets
Layer (SSL) accepts all certificates for outgoing connections of the email account.
The key to using this API is the enterprise account Id, which is obtained
using getAccountId(String, String, String) . A user can change this
parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result=emailAccountPolicy.
setOutGoingServerAcceptAllCertificates(true, accountId);
if(result){
Log.d(TAG," setOutGoingServerAcceptAllCertificates succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerAcceptAllCertificates failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result=emailAccountPolicy.
setOutGoingServerAcceptAllCertificates(true, accountId);
if(result){
Log.d(TAG," setOutGoingServerAcceptAllCertificates succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerAcceptAllCertificates failed.");
}
} 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. |
public
long
setOutGoingServerAddress
(String serverAddress, long accId)
Deprecated
in API level 27
API to set the outgoing server address.
Parameters
serverAddress
| Server address |
accId
| Id of account to be changed |
Returns
- Valid account id if successful, else -1.
Usage
An administrator can use this API to remotely configure the outgoing
server address of the email account. The key to using this API is the
managed email account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
NOTE: The account Id changes if this API call succeeds.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
long newAccId = emailAccountPolicy.setOutGoingServerAddress(
"smtp.gmail.com", accountId);
if(newAccId >0){
Log.d(TAG," setOutGoingServerAddress succeeded!");
// Administrator needs to call sendAccountsChangedBroadcast() API
// to notify about the email account changes.
// if the base parameter of existing email account changes, the existing
// email account Id is deleted and a new email account is
// created with a different account Id.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerAddress failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
long newAccId = emailAccountPolicy.setOutGoingServerAddress(
"smtp.gmail.com", accountId);
if(newAccId >0){
Log.d(TAG," setOutGoingServerAddress succeeded!");
// Administrator needs to call sendAccountsChangedBroadcast() API
// to notify about the email account changes.
// if the base parameter of existing email account changes, the existing
// email account Id is deleted and a new email account is
// created with a different account Id.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerAddress failed.");
}
} 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. |
public
boolean
setOutGoingServerPassword
(String password, long accId)
Deprecated
in API level 27
API to change the outgoing server password.
Parameters
password
| Password String
|
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure the outgoing
password of the email account. The key to using this API is the
managed account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setOutGoingServerPassword
("password123",accountId);
if(result){
Log.d(TAG," setOutGoingServerPassword succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerPassword failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setOutGoingServerPassword
("password123",accountId);
if(result){
Log.d(TAG," setOutGoingServerPassword succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerPassword failed.");
}
} 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. |
public
boolean
setOutGoingServerPort
(int port, long accId)
Deprecated
in API level 27
API to set the outgoing port number.
Parameters
port
| Port number |
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure the outgoing server
port of the email account. The key to using this API is the managed
account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setOutGoingServerPort(465,
accountId);
if(result){
Log.d(TAG," setOutGoingServerPort succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerPort failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setOutGoingServerPort(465,
accountId);
if(result){
Log.d(TAG," setOutGoingServerPort succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerPort failed.");
}
} 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. |
public
boolean
setOutGoingServerSSL
(boolean enableSSL, long accId)
Deprecated
in API level 27
API to enable or disable Secure Sockets Layer (SSL) on the outgoing email server
account.
Parameters
enableSSL
| true to enable, false to disable |
accId
| Id of the account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure whether SSL is
used for outgoing connections of the email account. The key to using
this API is the enterprise account Id, which is obtained using
getAccountId(String, String, String) . A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setOutGoingServerSSL(true,
accountId);
if(result){
Log.d(TAG," setOutGoingServerSSL succeeded!");
// Admin/User need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerSSL failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setOutGoingServerSSL(true,
accountId);
if(result){
Log.d(TAG," setOutGoingServerSSL succeeded!");
// Admin/User need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," setOutGoingServerSSL failed.");
}
} 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. |
public
boolean
setSenderName
(String senderName, long accId)
Deprecated
in API level 27
API to change the sender name of the email account.
Parameters
senderName
| Sender name String
|
accId
| Id of account to be changed |
Returns
true
if successful, else false
Usage
An administrator can use this API to remotely configure the
sender name of the email account. The key to using this API is the
managed account Id, which is obtained using
getAccountId(String, String, String) . A user can change
this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setSenderName("test", accountId);
if(result){
Log.d(TAG," Setting sender name succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Setting sender name failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setSenderName("test", accountId);
if(result){
Log.d(TAG," Setting sender name succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Setting sender name failed.");
}
} 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. |
public
boolean
setSignature
(String signature, long accId)
Deprecated
in API level 27
API to change the signature in the the email account.
Parameters
signature
| Signature String
|
accId
| Id of the account to be changed |
Returns
true
if success, else false
Usage
An administrator can use this API to remotely configure the signature
of the email account. The key to using this API is the managed account
Id, which is obtained using getAccountId(String, String, String) .
A user can change this parameter.
|
long accountId = -1;
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setSignature(
"MyTestSignature", accountId);
if(result){
Log.d(TAG," Setting signature succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Setting signature failed.");
}
} catch(SecurityException e) {
Log.w(TAG,"SecurityException: "+e);
}
|
For Container:
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);
EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();
try {
accountId = emailAccountPolicy.getAccountId("testemail@gmail.com",
"pop.gmail.com","pop3");
boolean result = emailAccountPolicy.setSignature(
"MyTestSignature", accountId);
if(result){
Log.d(TAG," Setting signature succeeded!");
// Administrator need to call sendAccountsChangedBroadcast() API
// to notify the email account changes.
emailAccountPolicy.sendAccountsChangedBroadcast();
}else{
Log.d(TAG," Setting signature failed.");
}
} 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. |