Thanks for this advice, Mark.

I would like to counter some of your suggestions by playing Devil's 
advocate, if I may.

"Most services do not expose intent filters."

OK, interesting - so those that *do* are presumably happy to be started by 
3rd parties? For example, I make an app called MusicPopup. It's simply a 
Service which I would be happy for 3rd parties to start and stop at their 
leisure. So, to export it I need to add some Intent Filters. This much I 
understand.

However, how would a program dynamically find my Service and 'know' that it 
can be used in this way? For Activities we have the aformentioned 
Action_Main and Category_Launcher that flag the Activity being runnable by 
3rd parties - is there a Service equivalent?

"Please do not start services just because you feel like it."

OK. But you hopefully agree that there are scenarios where starting a 
3rd-party service is desirable? See MusicPopup above. 

"This may come as a shock to you, but services are designed to be started 
(and hopefully stopped) by their own applications"

Harsh, and not strictly true - Services should be able to stop at any time, 
since Android may close them when resources are under pressure. The gap in 
my understanding is how Services can allow themselves to be discovered by 
programs such as Locale/Tasker and such. If I can learn this I can adapt 
MusicPopup to export its Service for 3rd parties. 

Finally, I can add a 'Service discovery' mechanism to my new app which only 
finds Services that are free to be started and stopped by 3rd parties.

How does that sound for a compromise?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to