Skip to content Skip to sidebar Skip to footer

Two Service With The Same Intent Filter

I have two applications installed on my device,each with a service component in it and these two service has the same intent filter declaration,like this: <

Solution 1:

If there are more than 1 Service with the same intent-filter then Android OS randomly selects one of these Services and pass to it the intent.

Solution 2:

If there are more than 1 Service with matching IntentFilter the one with highest priority will be picked. If there are multiple Services that have highest priority - than a "random" Service will be picked.

Here is the piece of code that insures that first item has highest priority:

https://github.com/aosp-mirror/platform_frameworks_base/blob/ics-mr0-release/services/java/com/android/server/IntentResolver.java

Post a Comment for "Two Service With The Same Intent Filter"