문제

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