为什么使用隐含的意图,开始并不安全服务? [英] Why is using an implicit intent to start a service not safe?
问题描述
当我开始和一个隐含的意图服务,我得到一个警告:
When I start a service with an implicit intent I get a warning:
与startservice隐意图是不是安全:...
Implicit intents with startservice are not safe: ...
为什么?
编辑:
我用我自己的内部类,没有任何其他应用程序应该使用我的服务没有出口的android:出口=FALSE
I am using my own internal category that no other application should use and my service is not exported android:exported="false"
.
推荐答案
使用隐式意图
您还没有指定一个组成部分,这意味着该组件将通过<选择code>的Android 由下式给出意向行动
。
By Using Implicit Intents
you have not specified a component, It means the component will be chosen by Android
by given Intent-Action
.
使用的android:出口=FALSE
将确保,其他无法启动服务。但是,如果我写了 BroadcastReeciver
侦听的应用程序的意向行动
并做一些恶意的工作?
Using android:exported="false"
will make sure that, other can not start your service. But what if I wrote an application with BroadcastReeciver
which listens your Intent-Action
and do some malicious work?
当我宣布一个服务到我的应用程序同样会发生,并使用相同的类别/过滤/动作。
And same would happen when I declared a Service into my application and use the same category/ filter/ action.
因此,使用显式意图
。
这篇关于为什么使用隐含的意图,开始并不安全服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!