Monitoring the current application
I am facing a problem that I cannot solve at the moment.
The purpose of the code is to control which applications are currently running.
I used the following code and registered the resulting package name, it worked.
ActivityManager am = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE); String packageName = am.getRunningTasks(1).get(0).topActivity.getPackageName(); Log.i("TTWYMonitor", packageName);
But I am using this code in
, nothing happened. In
I announced the receiver intent
What to do, then? Please give any suggestion.
Yahel : Thanks and sorry for my informal question.
source to share