撒施接收传入Gmail的 [英] Broad cast receiver for Incoming Gmails
问题描述
我需要做的是创建一个自定义的产生提示音为每个到来的Gmail根据发件人的应用程序。所以我需要当新邮件到达通知并同时获得电子邮件发件人的EMAIL_ID或名称。
少数来到我脑海中的解决方案是,
What I need to do is to create an app that produces custom notification sounds for each incoming Gmail depending upon the sender. So I need to be notified when a new mail arrives and also get the email_id or Name of the sender of the email. Few of the solutions that came to my mind were,
1)Gmail标签API - 但它并不提供有关内部或通知的电子邮件信息。
2)使用内容解析与READ_GMAIL许可 - 我认为的Gmail已经停止对新版本的Gmail访问。
3)阅读通知栏或通知监听器 - 的Android不会允许读取通知栏
1) Gmail labels API - But it doesn't provide info about the emails inside or notifies. 2) Using content resolver with READ_GMAIL permission - I think Gmail has stopped access on newer Gmail versions. 3) Reading notification bar or a notification listener - Android wont allow to read notification bar.
有没有可以解决这个问题的任何其他解决方法?
Is there any other workarounds which can solve this?
推荐答案
我不知道,希望这将帮助你。
I am not sure, hope this will help you out
- 您需要注册一个观察者的内容(而不是广播接收器)
contentResolver.registerContentObserver(Uri.parse(内容:// gmail- LS),真的,_gmailObserver);
_gmailObserver
是你自己的 ContentObserver
对象。
-
ContentObserver.onChange
将被称为每次变化的东西在Gmail中。
ContentObserver.onChange
is going to be called every time something changes in Gmail.
在这里,你会得到所有对话,像这样:
Here you get all conversations like so:
Cursor conversations = _contetResolver.query(Uri.parse("content://gmail-ls/conversations/" + YourEmailAddress, null, null, null, null);
和实际交谈的消息将是:
And the actual conversation messages will be:
Cursor messages = _contetResolver.query(Uri .parse("content://gmail-ls/conversations/" + YourEmailAddress + "/" + String.valueOf(conversationId) + "/messages"), null, null, null, null);
这篇关于撒施接收传入Gmail的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!