How to execute some code when new email arrives in Android?

自古美人都是妖i 提交于 2020-01-02 20:06:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!