I am developing an application that receives a notification when an Activity selected by the user is launched. For this, the best approach would be to register a BroadcastReceiver for ACTION_MAIN explicit ACTION_MAIN that, as far as I know, do not work (since these Intent have specific goals). Another, possibly less effective, approach is to use the ActivityManager system and a poll on getRunningTask() , which returns a list of all currently running tasks. The survey may be performed by a background service. Watching the changes in this list, I see if the work is working or not, so that my application can receive a notification. The disadvantage, of course, is the survey. I have not tried this yet, but I think this last approach will probably work.
Does anyone know of a more efficient approach or suggestions that are less intense?
qtips source share