The system will arbitrarily pick one of them. Which it is is not defined. The one it picks can change at any time -- typically though it could change when installing or uninstalling an app that has a service that matches the intent, or after rebooting.
No UI is shown because binding to a service is not a UI event. If you want to the user to pick one of them, you can very easily do this yourself -- just ask the package manager for all of the services that match the intent, and show the list to the user. On Mon, May 16, 2011 at 5:22 AM, Mark Cz <[email protected]> wrote: > I did something that works but I am still a bit confused. > > The manifest in App A, App B and App C, is the same, > as the user doesn't have to nstall App A. But I still want the my > service to be running. > > So in all the manifests I did something like > > <service android:enabled="true" android:exported="true" > android:name=".TestService"> > <intent-filter> > <category > android:name="android.intent.category.DEFAULT" /> > <action > android:name="com.myprivate.action.MARK" /> > </intent-filter> > </service> > > and in all > > App A/B/C/D.Activity.onCreate() { > ... > Intent intent = new Intent("com.myprivate.action.MARK"); > startService(intent); > ... > } > > And the outcome that startService doesn't create the service if it is > already exist. > And the "Package Name" of the service is of the FIRST installation. > > I don't understand why while there are 2 (or more) identical intent > filters, we don't get an error message > of collision. > In case of Activities we can manually choose which activity will > handle the intent. > > > > On May 16, 1:36 pm, Mark Murphy <[email protected]> wrote: > > On Mon, May 16, 2011 at 3:22 AM, Mark Cz <[email protected]> wrote: > > > Thanks Mark, > > > I haven't clarify myself in the previous form. > > > I have two (or more) apks/applications, When the user opens one of my > > > applications (called APP A), it starts a service, > > > when the user opens another application (called APP B), it doesn't > > > start a service but uses the service. But i want to get this behavior > > > when the > > > user chooses to open first APP B and then APP A. > > > > startService() starts the service if it is not running. bindService() > > with FLAG_AUTO_CREATE will start the service if it is not running. > > Whether these are called from App A, App B, App C, App D, etc. makes > > no difference. App A will always be the one "running" the service, > > insofar as it will run in App A's process. > > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com| > http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > > > Android Training in London:http://bit.ly/smand1,http://bit.ly/smand2 > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

