I have a service that runs in the background.
I want this service to see which app the user has in the foreground.
I can do it with the service is running every second and checks which app is in the foreground this will kill the battery.
Are there an handler or a broadcast that can start the service when the app is changed in the foreground?
I can see that the activitymanager writes to the logcat(in eclipse) when I change apps.