I want to know (with user's permissions) when few specifics apps / activities where activated by the user, e.g. user open Gmail app.
Currently I'm doing it by ActivityManager.getRunningTasks periodically, but it’s not a good solution. Any ideas how to do it better?