two service with the same intent filter

前端 未结 2 1775
自闭症患者
自闭症患者 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

提交回复
热议问题