Frage

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".

War es hilfreich?

Lösung

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.

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top