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://email@example.com"), null, "label:^u", null, null);
int subjectIdx = unread.getColumnIndex("subject");
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.