1

I have a Service running and i want the service to be informed when certain apps get opened and closed / stopped. I think the start of an App is possible to listen on, but what about the start/resume and the stop ?

AdrianoCelentano
  • 2,461
  • 3
  • 31
  • 42

1 Answers1

1

Perhaps check the foreground application?

See this SO thread: Determining the current foreground application from a background task or service

When the application changes, you know that the app has been stopped/paused.

Community
  • 1
  • 1
dthomasen
  • 826
  • 15
  • 32
  • this is already really nice, though i have to check manually instead of listening, but if there is no other solution to it, this will be it – AdrianoCelentano Sep 02 '14 at 12:52
  • I don't think there's any other way to do it, as it would be a security issue to be able to read other apps state. – dthomasen Sep 02 '14 at 12:54