title: Best way to determine to current foreground application, Android
body: <p>This question has been answered elsewhere but all solutions use ".getRunningTask()", which has been depreciated in the most recent API.  I am trying to make an app that allows people to monitor their phone use and need to know when an app come to the foreground and when the foreground app changes.</p>