Chr*_*Orr 5 android intentfilter android-intent
我有一种感觉,这是不可能的,但我想我会得到一些确认......
我想要一个对某些HTTP URL做出反应的应用程序,我知道我可以在清单中预先定义一些类似这样的条目:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="example.com" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
但是,我希望用户添加(或可能删除)主机,例如添加"http://example.net"或停用预定义的"http://example.com/"条目.
当然,我可以通过在前台Activity中注册动态广播接收器来捕获此类Intent.
但是可以在安装后向系统注册新的intent过滤器,这样我的应用程序就不需要在前台捕获与新添加的主机名匹配的意图吗?
好问题。
不确定是否可能,但我会:
registerReceiver()a) 测试当您使用 中的方法注册接收器时会发生什么Context。也许它会以某种方式持续存在。
b) 在永无止境的内部设置动态广播接收器Service。(是的,这很丑,我知道)
| 归档时间: |
|
| 查看次数: |
603 次 |
| 最近记录: |