0

Possible Duplicate:
Determining the current foreground application from a background task or service
android:how to check if application is running in background

I would like to start/stop my service when an app is launched (YouTube, Video App, every other app). Is it possible to do. If so, how can I implement this?

Community
  • 1
  • 1
Angelo Tricarico
  • 1,333
  • 1
  • 19
  • 36

1 Answers1

0

Sorry, misread your question.

When your application is backgrounded (which you can detect with onPause) you can start your service. In your service you'll want to detect the application that is currently in foreground.

You can do that by reading this question.

Community
  • 1
  • 1
jlindenbaum
  • 1,891
  • 18
  • 28