创建于Android的一个IntentFilter的匹配所有意图 [英] Create an IntentFilter in android that matches ALL intents

查看:76
本文介绍了创建于Android的一个IntentFilter的匹配所有意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能(也许用一个BroadcastReceiver方式)创建于Android的一个IntentFilter的匹配所广播的手机上的所有意图? I.E.那些我在DDMS看到的时候我用的是手机,ActivityManager标记下?通过文档挖掘,看着框架源之后,我留下来想不能这样做?那你必须指定一些类型的数据,套用的文档,有些类型的数据必须被指定,否则你得到的就只是意图没有数据。该应用程序我写这封信需要知道的就是在系统上启动的每个应用程序。到目前为止,我已经能够做到这一点的唯一方法是通过轮询ActivityManager。这似乎是最好的办法是有一个事件驱动的解决方案,可以使用任何背后的逻辑ActivityManager使用,但它的所有希腊给我ActivityManager.java框架源里面,好像有很多下面的东西(如果不是全部)是特意从我的封装。

Is it possible to create an IntentFilter in android that matches ALL intents that are Broadcasted on the phone (perhaps by way of using a BroadcastReceiver)? I.E. the ones I see in ddms when I use the phone, under the ActivityManager tag? After digging through the documentation, and looking at the framework source, I am left to think it can't be done? That you must specify some sort of data, to paraphrase the docs, "some sort of data must be specified, or else you'll only get intents with no data". The app I am writing needs to know about every app that is started on the system. So far, the only way I have been able to do this is by polling ActivityManager. It seems the best way would be to have an event driven solution, using whatever underlying logic ActivityManager uses, but it's all greek to me inside of the ActivityManager.java framework source, and seems like a lot of the stuff underneath (if not ALL) is deliberately encapsulated from me.

任何想法?

推荐答案

你自己说的,文件十分清楚地规定过滤器是怎样意图的功能,而这是不可能接收所有的广播。

You said it yourself, the documentation quite clearly specifies how intent filters function and that this is not possible to receive all broadcasts.

非此非彼检索任务信息是支持在Android SDK的公开API的东西。

Neither this nor retrieving task information is something that is supported by the APIs made public in the Android SDK.

这篇关于创建于Android的一个IntentFilter的匹配所有意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆