Hello I am developing an application where I required to find time spent by user on a certain app like Facebook.
Whenever user has spent x minutes then I want to giv
As noted in the question Detect When other Application opened or Launched, you cannot listen for other applications launch signals, but you could sample the list of open applications every so often to check if the app you are looking for is a) running and b) in the foreground.
You would have to run this application as a service in the background, and I'm pretty sure that it could have devastating implications on the user's phone battery life.