Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6981493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:09:52+00:00 2026-05-27T18:09:52+00:00

I have two applications installed on my device,each with a service component in it

  • 0

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:

<intent-filter>
<action android:name="com.example.intent.action.SHOW"/>
</intent-filter>

And I start the service in this way:

Intent intent = new Intent();
intent.setAction("com.example.intent.action.SHOW");
startService(intent);

I found that one of these two services started,but I am not sure how this happened.As we know,if we write two activities with the same intent filter declaration,a dialog will be poped up and let the user chooses a activity to complete the action.What got me confused is that how Android chooses the service to be started in these who has the same intent filters,what’s the strategy of making this decision?

Thanks in advance!

update:
Yury is right, here is code snippet from frameworks/base/services/java/com/android/server/pm/PackageMangerService.java on ICS:

public ResolveInfo resolveService(Intent intent, String resolvedType,
    int flags) {
List<ResolveInfo> query = queryIntentServices(intent, resolvedType,
        flags);
if (query != null) {
    if (query.size() >= 1) {
        // If there is more than one service with the same priority,
        // just arbitrarily pick the first one.
        return query.get(0);
    }
}
return null;
}

As we can see,if there are more than one service match the requested intent, Android will arbitrarily pick one to start. But, which service will be actually started is unexpected.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:09:53+00:00Added an answer on May 27, 2026 at 6:09 pm

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two applications written in Java that communicate with each other using XML
I have two applications under tomcat/webapps folder. tomcat/webapps/App1 tomcat/webapps/App2 Both applications share the same
I have two applications: c++ service and a RoR web server (they are both
If you have two applications residing on the same server, can you use Server.Transfer
I have two applications which use the same content provider, but I can't put
I have two identical web services currently installed on the same PC for testing
I have two applications setup in IIS7.5. MVC 3 is installed. One application serves
i have two https web applications app1 and app2 installed on two different tomcats
i have two websites with FormsAuthentication which are installed on the same machine. Now
I have two applications in two solutions in VS2008 that share a common dll,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.