简体   繁体   English

Whither GMail的PROVIDER_CHANGED意图

[英]Whither GMail's PROVIDER_CHANGED intent

I have been struggling to get PROVIDER_CHANGED to fire in my receiver. 我一直在努力让PROVIDER_CHANGED在我的接收器中开火。 I am trying to detect new GMail. 我正在尝试检测新的GMail。 I know that the undocumented access to content://gmail-ls is now closed; 我知道对content:// gmail-ls的无证访问现已关闭; all I need to capture is the PROVIDER_CHANGED intent, following which I can access GMail via POP/IMAP. 我需要捕获的只是PROVIDER_CHANGED意图,之后我可以通过POP / IMAP访问GMail。

I can see the Intent in DDMS, as well as in CatLog, just mystified why I can see it in my app. 我可以在DDMS和CatLog中看到Intent,这只是为什么我可以在我的应用程序中看到它的原因。 If CatLog can see it, I should too, yes? 如果CatLog可以看到它,我也应该知道吗?

Here is my manifest. 这是我的清单。 I have a couple of other broadcast intents (battery low etc, not shown here) that do fire OK. 我还有其他一些广播意图(电池电量不足等,此处未显示)确实可以。

<receiver android:name=".MyReceiver">
  <intent-filter>
    <action android:name="android.intent.action.PROVIDER_CHANGED"/>
  </intent-filter>          
</receiver>

And my receiver class: 而我的接收器类:

public class MyReceiver extends BroadcastReceiver
{   
    static Context context = null;
    @Override
    public void onReceive(Context ctxt, Intent intent)
    {
        context = ctxt;

        Log.d("MYAPP", intent.toString());
                    if("android.intent.action.PROVIDER_CHANGED".equals(intent.getAction()))
        {
                      ...
                    }
          }

Try to specify android:scheme for the intent filter 尝试为意图过滤器指定android:scheme

Here is the update: 这是更新:

<receiver android:name=".MyReceiver">
  <intent-filter>
    <action android:name="android.intent.action.PROVIDER_CHANGED"/>
    <data android:scheme="content" />
  </intent-filter>          
</receiver>

I think you're going about this the wrong way, take a look at the 我认为您的做法是错误的,请看一下

Gmail API Gmail API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么PROVIDER_CHANGED无法在android studio中工作? - why PROVIDER_CHANGED not working in android studio? CONNECTIVITY_CHANGE,WIFI_STATE_CHANGED和PROVIDER_CHANGED的BroadcastReceiver - BroadcastReceiver for CONNECTIVITY_CHANGE, WIFI_STATE_CHANGED and PROVIDER_CHANGED Android Intent就像Gmail的附加Intent一样 - Android Intent like Gmail's attach Intent 对于GMail,通过Android的Intent发送附加到电子邮件的zip文件失败 - Sending a zipfile attached to email via Android's Intent fails for GMail Android O-android.intent.action.PROVIDER_CHANGED是否受BroadcastRecevier限制影响? - Android O - android.intent.action.PROVIDER_CHANGED affected by BroadcastRecevier limitations? Android中Gmail的操作意图? - Action Intent for Gmail in android? Android:如何从LocationManager发送的KEY_STATUS_CHANGED广播意图中查找位置提供者名称? - Android: How to find out location provider name from KEY_STATUS_CHANGED broadcast intent sent by LocationManager? 打开Gmail邮件意图 - Open gmail message intent 通过提供者作为额外的意图 - Pass Provider as extra of Intent Android 的 Gmail 应用程序是否取消了通过 Intent 发送 HTML 电子邮件的功能? - Has Android's Gmail app removed the ability to send HTML emails via Intent?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM