two service with the same intent filter

前端 未结 2 1765
自闭症患者
自闭症患者 2021-01-04 05:25

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:

&l         


        
相关标签:
2条回答
  • 2021-01-04 05:46

    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

    0 讨论(0)
  • 2021-01-04 06:11

    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.

    0 讨论(0)
提交回复
热议问题