如何以编程方式捕获意图(使用动作“android.intent.action.VIEW”)

时间:2012-12-07 13:37:53

标签: android android-intent broadcastreceiver intentfilter

我在预览Gmail附件时收到了关注日志。我想以编程方式接收(嗅探)此意图(使用操作android.intent.action.VIEW)。我已经使用android.intent.action.VIEW动作创建了意图过滤器,我已经使用广播接收器注册了此过滤器。不过,我无法接收广播的意图。

如何以编程方式实现它?非常感谢。

LogCat:
12-07 18:21:50.528: I/ActivityManager(96): Starting: Intent { dat=content://gmail-ls/messages/hawkagent%40interfaceinfosoft.com/35/attachments/0.1/BEST/false cmp=com.google.android.gm/.ViewAttachmentActivity } from pid 8309

12-07 18:21:52.598: I/ActivityManager(96): Starting: Intent { act=android.intent.action.VIEW dat=content://gmail-ls/messages/hawkagent%40interfaceinfosoft.com/35/attachments/0.1/BEST/false typ=text/plain flg=0x80001 cmp=android/com.android.internal.app.ResolverActivity } from pid 8309

1 个答案:

答案 0 :(得分:0)

您是否在AndroidManifest.xml中注册了Receiver:

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