views:

524

answers:

2

Is there a way I can be notified of an application launch and termination in Android? I mean, more like subscribing to the Activity Manager and then determining which applications have been started and stopped...

+1  A: 

My first instinct is to point you towards the BroadcastReceiver class, but checking the list of Intent flags available to listen for, I'm not seeing anything dealing with application startup/shutdown. I guess the best thing to do is start with this and see if there's some sort of acrobatics you can do that I'm missing in my quick glance.

MattC
But isn't that assuming that the application is actually sending a broadcast of its launch (or to that matter, any of its state) or am I totally off the track?
Legend
Well the system sends broadcasts for certain events too. My hope is that there's some sort of broadcast for app startup/shutdown and I'm just missing it.
MattC
Thank You. I will investigate this matter further.
Legend
A: 

I'm investigating the same thing. Did you come up with a solution?

JW