質問

When I start a service with an implicit intent I get a warning:

Implicit intents with startservice are not safe: ...

Why?

Edit:

I am using my own internal category that no other application should use and my service is not exported android:exported="false".

役に立ちましたか?

解決

By Using Implicit Intents you have not specified a component, It means the component will be chosen by Android by given Intent-Action.

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.

So use Explicit Intents.

他のヒント

If you have multiple Service(s) with the same IntentFilter, System do not know which one should be started, and system will not ask users to choose.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top