Incoming mails notification on android

I am looking for a way to programmatically intercept incoming emails on Android, no matter their source (gmail, exchange, IMAP, etc.). My main concern is to have a look at the mail headers rather than the mail body. It can be done for GMail only using the following code –

ContentResolver cr = getContentResolver();
Cursor unread = cr.query(Uri.parse("content://gmail-ls/conversations/xxxxxx@gmail.com"), null, "label:^u", null, null);
unread.moveToFirst();
int subjectIdx = unread.getColumnIndex("subject");

do {
String subject = unread.getString(subjectIdx);
} while (unread.moveToNext());

Is somethink like this available to non-gmail accounts? I know that theoretically I can ask the user for the username and password and connect via imap, but I can’t do it from the business aspect.

Any solution that is possible will be welcome, i.e. Java SDK, NDK, undocumented API or whatever means necessary.


Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at info@nanostuffs.com, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box