0

I'm having trouble detecting when another apps are opened using a background service or listener. As soon as I start my application I launch the background service and what I'd like to do is make it detect when OTHER applications are launched (or resumed). How can I achieve this? I'm up to anything, thank you very much

1 Answers1

0

you may want to look at ActivityManager. The getRunningAppProcesses method or getRunningTasks method can give you access to currently running tasks or app processes. You can use this list to track running or recent app(s).

ashoke
  • 6,441
  • 2
  • 26
  • 25
  • but is it possible to do this as soon as the app is opened? – Richard Norton Sep 10 '14 at 09:12
  • you will need to do the book keeping, [please see this question](http://stackoverflow.com/questions/8061179/broadcast-receiver-to-detect-application-start). For app restarts, you can create a broadcast [receiver for intent android.intent.action.PACKAGE_RESTARTED](http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_RESTARTED) – ashoke Sep 13 '14 at 21:20