public static synchronized com.android.email.mail.Store | getInstance(java.lang.String uri, android.app.Application application)Get an instance of a mail store. The URI is parsed as a standard URI and
the scheme is used to determine which protocol will be used. The
following schemes are currently recognized: imap - IMAP with no
connection security. Ex: imap://username:password@host/ imap+tls - IMAP
with TLS connection security, if the server supports it. Ex:
imap+tls://username:password@host imap+tls+ - IMAP with required TLS
connection security. Connection fails if TLS is not available. Ex:
imap+tls+://username:password@host imap+ssl+ - IMAP with required SSL
connection security. Connection fails if SSL is not available. Ex:
imap+ssl+://username:password@host
Store store = mStores.get(uri);
if (store == null) {
if (uri.startsWith(STORE_SCHEME_IMAP)) {
store = new ImapStore(uri);
} else if (uri.startsWith(STORE_SCHEME_POP3)) {
store = new Pop3Store(uri);
} else if (uri.startsWith(STORE_SCHEME_LOCAL)) {
store = new LocalStore(uri, application);
}
if (store != null) {
mStores.put(uri, store);
}
}
if (store == null) {
throw new MessagingException("Unable to locate an applicable Store for " + uri);
}
return store;
|