简体   繁体   中英

Whither GMail's PROVIDER_CHANGED intent

I have been struggling to get PROVIDER_CHANGED to fire in my receiver. I am trying to detect new GMail. I know that the undocumented access to content://gmail-ls is now closed; all I need to capture is the PROVIDER_CHANGED intent, following which I can access GMail via POP/IMAP.

I can see the Intent in DDMS, as well as in CatLog, just mystified why I can see it in my app. If CatLog can see it, I should too, yes?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM