Reputation: 1163
I could not find a way to listen email received event. Can any one please suggest me on this.
your valuable suggestions are highly appreciated.
Upvotes: 0
Views: 1766
Reputation: 1163
I could succeed upto an extent, Now I could receive events for any changes happening in gmail account but still i am not clear about how to find only incoming mails.
Note: I got some hacking techniques for getting this done but it will not work starting from froyo release.
currently I am using below code: onChange method will get invoked for any changes happening in gmail.
mContext.getContentResolver().registerContentObserver(Uri.parse("content://gmail-ls/unread"), false, GmailObserver(new Handler() {}));
class GmailObserver extends ContentObserver {
public GmailObserver(Handler handler) {
super(handler);
}
@Override
public boolean deliverSelfNotifications() {
System.out.println("@@@ ContentObserver deliverSelfNotifications");
return super.deliverSelfNotifications();
}
@Override
public void onChange(boolean selfChange) {
System.out.println("@@@ ContentObserver onChange");
super.onChange(selfChange);
}
}
Upvotes: 0
Reputation:
The answer is no. 3rd party apps can't access the stock Email applications data.
Upvotes: 1