问题
I am new in Android.
How can I execute some code when new email arrives (gmail) in Android? Is there a way to do that?
回答1:
How can I execute some code when new email arrives (gmail) in Android?
There are no documented broadcast Intents
that are sent out when Gmail arrives. Gmail is not part of the Android OS, so it is not part of the Android SDK, and it does not have its own SDK.
回答2:
for that you have to use Broadcast Receivers
回答3:
I could get it work on myself with searching some source codes of different programs. But it is really hacky. Since there is no documented broadcast about it, I won't share any code. If anyone interested, can take a look at GmailNotifier source code at github.
GmailNotifier notifies user when receive new GMail.
P.S: And please note that, it is only for GMAIL. Not all email as title says. (A moderator has edited it, idk why.)
来源:https://stackoverflow.com/questions/5818685/how-to-execute-some-code-when-new-email-arrives-in-android