com.ardic.android.managers.emailconfig.IEmailConfigManager |
Provides a set of APIs for e-mail related configurations.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ERROR_ACCESS_DENIED | e-mail account add or update error code for the case of the server refused access | |||||||||
int | ERROR_AUTHENTICATION | e-mail account add or update error code for the case of authentication error | |||||||||
int | ERROR_AUTH_REQUIRED | e-mail account add or update error code for the case of authentication is required but the server did not support it. | |||||||||
int | ERROR_CLIENT_CERTIFICATE_ERROR | e-mail account add or update error code for the case of the client SSL certificate specified is invalid | |||||||||
int | ERROR_CLIENT_CERTIFICATE_REQUIRED | e-mail account add or update error code for the case of a client SSL certificate is required for connections to the server | |||||||||
int | ERROR_DUPLICATE_ACCOUNT | e-mail account add or update error code for the case of attempt to create duplicate account | |||||||||
int | ERROR_GENERAL_SECURITY | e-mail account add or update error code for the case of general security failures | |||||||||
int | ERROR_NETWORK | e-mail account add or update error code for the case of network error | |||||||||
int | ERROR_PROTOCOL_VERSION_UNSUPPORTED | e-mail account add or update error code for the case of the protocol (or protocol version) isn't supported | |||||||||
int | ERROR_TLS_REQUIRED | e-mail account add or update error code for the case of the configuration requested TLS but the server did not support it | |||||||||
int | ERROR_UNSPECIFIED | e-mail account add or update error code for the case of unspecified error |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds an new e-mail account.
| |||||||||||
Updates an existing e-mail account.
| |||||||||||
Returns list of e-mail accounts.
| |||||||||||
Gets an e-mail account.
| |||||||||||
Returns account ID of the given e-mail settings.
| |||||||||||
Returns Block or Unblock state of User Email Account setup.
| |||||||||||
Registers to email config callback to get all email account operation results.
| |||||||||||
Block or Unblock User Email Account setup.
| |||||||||||
Unregisters from email config callback to get email account creation state.
| |||||||||||
Updates an existing e-mail account.
|
e-mail account add or update error code for the case of the server refused access
e-mail account add or update error code for the case of authentication error
e-mail account add or update error code for the case of authentication is required but the server did not support it.
e-mail account add or update error code for the case of the client SSL certificate specified is invalid
e-mail account add or update error code for the case of a client SSL certificate is required for connections to the server
e-mail account add or update error code for the case of attempt to create duplicate account
e-mail account add or update error code for the case of general security failures
e-mail account add or update error code for the case of network error
e-mail account add or update error code for the case of the protocol (or protocol version) isn't supported
e-mail account add or update error code for the case of the configuration requested TLS but the server did not support it
e-mail account add or update error code for the case of unspecified error
Adds an new e-mail account.
Device must be able to connected to the e-mail server. Otherwise operation fails.
Register callback registerEmailCallback(IEmailConfigCallback)
to receive all email
add/update/delete operation results.
Example usage:
EmailConfigExchange config = new EmailConfigExchange("My Account", "John.Smith", "john.smith@example.com", "123456", "mail.example.com", 443, EmailConfig.AUTH_SSL_TLS, "WORK", "Johny", "Regards", EmailConfig.INTERVAL_AUTO_PUSH, "14.1", EmailConfigExchange.LOOKBACK_ALL, "test_user", true); boolean attempt = EmailConfigManager.getInterface(mContext).addEmailAccount((EmailConfig) config);
Parameters | |
---|---|
config |
EmailConfig :
e-mail account configuration |
Returns | |
---|---|
boolean |
true if the add operation started else false . Invalid parameters
prevents add operation start. |
Throws | |
---|---|
|
AfexException |
AfexException |
See also:
EmailConfig(EmailConfig.AccountType, String, String, String, String, String, int, int, String, String, int)
EmailConfigExchange(String, String, String, String, String, int, int, String, String, int, String, String, int, String, boolean)
EmailConfigPop3(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
EmailConfigImap(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
Updates an existing e-mail account.
Register callback registerEmailCallback(IEmailConfigCallback)
to receive all email
add/update/delete operation results.
Example usage:
final long accId = EmailConfigManager.getInterface(mContext).getEmailAccountId("mail.example.com", "WORK", John.Smith); boolean attempt = EmailConfigManager.getInterface(mContext).deleteEmailAccount(accId);
Parameters | |
---|---|
accId |
long :
Account ID |
Returns | |
---|---|
boolean |
true if the operation starts else false . Invalid or non-existent
account ID prevents operation start. Also, if any e-mail account add or update
operation is in progress delete operation fails. |
Throws | |
---|---|
AfexException |
Returns list of e-mail accounts. Example usage:
List<EmailConfig> configList = EmailConfigManager.getInterface(mContext).getAllEmailAccounts(); for (EmailConfig config : configList) { if (config instanceof EmailConfigExchange) { ((EmailConfigExchange) config).getProtocolVersion(); } else if (config instanceof EmailConfigImap) { ((EmailConfigImap) config).getImapPathPrefix(); } else if (config instanceof EmailConfigPop3) { ((EmailConfigPop3) config).getOutgoingServerAddress(); } }
Returns | |
---|---|
List<EmailConfig> |
List of account configurations. |
Throws | |
---|---|
|
AfexException |
AfexException |
See also:
EmailConfig(EmailConfig.AccountType, String, String, String, String, String, int, int, String, String, int)
EmailConfigExchange(String, String, String, String, String, int, int, String, String, int, String, String, int, String, boolean)
EmailConfigPop3(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
EmailConfigImap(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
Gets an e-mail account.
Example usage:
final long accId = EmailConfigManager.getInterface(mContext).getEmailAccountId("mail.example.com", "WORK", John.Smith); EmailConfig config = EmailConfigManager.getInterface(mContext).getEmailAccount(accId); if (config instanceof EmailConfigExchange) { ((EmailConfigExchange) config).getProtocolVersion(); } else if (config instanceof EmailConfigImap) { ((EmailConfigImap) config).getImapPathPrefix(); } else if (config instanceof EmailConfigPop3) { ((EmailConfigPop3) config).getOutgoingServerAddress(); }
Parameters | |
---|---|
accId |
long :
Account ID. |
Returns | |
---|---|
EmailConfig |
Account configuration. |
Throws | |
---|---|
|
AfexException |
AfexException |
See also:
EmailConfig(EmailConfig.AccountType, String, String, String, String, String, int, int, String, String, int)
EmailConfigExchange(String, String, String, String, String, int, int, String, String, int, String, String, int, String, boolean)
EmailConfigPop3(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
EmailConfigImap(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
Returns account ID of the given e-mail settings.
Parameters | |
---|---|
servername |
String :
server address. |
domainname |
String :
eas domain name |
username |
String :
username of the e-mail account. |
Returns | |
---|---|
long |
Account ID positive integer if the operation succeeds else -1 |
Throws | |
---|---|
|
AfexException |
AfexException |
See also:
EmailConfig(EmailConfig.AccountType, String, String, String, String, String, int, int, String, String, int)
EmailConfigExchange(String, String, String, String, String, int, int, String, String, int, String, String, int, String, boolean)
EmailConfigPop3(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
EmailConfigImap(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
Returns Block or Unblock state of User Email Account setup.
Returns | |
---|---|
boolean |
true if it is blocked else false |
Throws | |
---|---|
AfexException |
Registers to email config callback to get all email account operation results.
All Email operation (add/update/delete) results can be received by registering the callback.
Example usage:
IEmailConfigCallback iEmailConfigCallback = new IEmailConfigCallback.Stub() { // @Override public void onEmailConfigAborted() throws RemoteException { } // @Override public void onEmailConfigAdded(EmailConfig config) throws RemoteException { } // @Override public void onEmailConfigUpdated(EmailConfig config) throws RemoteException { } // @Override public void onEmailConfigRemoved(EmailConfig config) throws RemoteException { } // @Override public void onEmailConfigAdditionFailed(EmailConfig config, int errorCode) throws RemoteException { } // @Override public void onEmailConfigUpdateFailed(EmailConfig config, int errorCode) throws RemoteException { } // @Override public void onEmailConfigRemoveFailed(EmailConfig config, int errorCode) throws RemoteException { } }; try { EmailConfigManager.getInterface(getApplicationContext()).registerEmailCallback( iEmailConfigCallback); } catch (AfexException e) { e.printStackTrace(); }Warning: By registering one callback all Email operations can received. if multiple instance of callback is required , each application can registers max 10 callback. So although you register 11. callback, it won't be registered. You should unregister some of them or unregister all of them by passing null parameter as callback.
Parameters | |
---|---|
callback |
IEmailConfigCallback :
IEmailConfigCallback to unregister it or null to unregister
all of registered callbacks by calling application. |
Returns | |
---|---|
boolean |
true if callback registration is succeeded else false |
Throws | |
---|---|
AfexException |
Block or Unblock User Email Account setup.
if it is blocked, user can not setup any e-mail account using Native Email Application.
Parameters | |
---|---|
state |
boolean
|
Returns | |
---|---|
boolean |
true if it is blocked else false |
Throws | |
---|---|
AfexException |
Unregisters from email config callback to get email account creation state.
Parameters | |
---|---|
callback |
IEmailConfigCallback :
IEmailConfigCallback |
Returns | |
---|---|
boolean |
true if callback unregistration is succeeded else false |
Throws | |
---|---|
AfexException |
Updates an existing e-mail account.
Device must be able to connected to the e-mail server. Otherwise operation fails.
Register callback registerEmailCallback(IEmailConfigCallback)
to receive all email
add/update/delete operation results.
Example usage:
EmailConfigExchange config = new EmailConfigExchange("My New Account", "John.Smith", "john.smith@example.com", "654321", "mail.example.com", 443, EmailConfig.AUTH_SSL_TLS, "WORK", "Johny", "Regards", EmailConfig.INTERVAL_AUTO_PUSH, "14.1", EmailConfigExchange.LOOKBACK_ALL, "test_user", true); config.setPwd("MoreSecurePassword123456"); // get email account id final long accId = EmailConfigManager.getInterface(mContext).getEmailAccountId("mail.example.com", "WORK", John.Smith); // update account password boolean attempt = EmailConfigManager.getInterface(mContext).updateEmailAccount(accId, (EmailConfig) config);
Parameters | |
---|---|
accId |
long :
Account ID |
config |
EmailConfig :
new e-mail account configuration. |
Returns | |
---|---|
boolean |
true if the operation starts else false . Invalid parameters prevents
update operation start. |
Throws | |
---|---|
|
AfexException |
AfexException |
See also:
EmailConfig(EmailConfig.AccountType, String, String, String, String, String, int, int, String, String, int)
EmailConfigExchange(String, String, String, String, String, int, int, String, String, int, String, String, int, String, boolean)
EmailConfigPop3(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)
EmailConfigImap(String, String, String, String, String, int, int, String, String, int, String, int, int, boolean)