I\'m trying to develop an app that prevents a user from getting to a specified app without a password. The scenario is...
A gimmicky way to do it is have a service with a timed loop that checks
ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List runningAppProcessInfo = am.getRunningAppProcesses();
You run through that list to look at what is running on the phone. Now you can identify them with ids and processName, so for standard activity this is easy for custom ones well unless you stop them all its hard to discriminate...
Note: this isnt a list of whats is actually on the screen, just a list of whats is running...kinda nullifying your goal maybe but at least you will know when something is starting to run... it will keep being in that list even when in background though.
For the password thing you can just start your activity when you found an app thats protected or whatever.