0

Can someone give the explaination about this question that how this detected application launch by catching startapplication calls in the launcher in the following question?

Detecting android Activity launches

Some code would be highly appreciated. I have tried the first two options but having the same problems. Kindly Help

Details:

I need to detect Application Launch in Android. That whenever any application is opened, my application should be triggered. This is very similar to what App Locking applications do.

I have written the following code in a service to get the currently running application:

ActivityManager mngr = (ActivityManager) getSystemService( ACTIVITY_SERVICE );
List<ActivityManager.RunningTaskInfo> taskList = mngr.getRunningTasks(2);
String CurrApp = taskList.get(0).baseActivity.getPackageName();

The problem is that I need to detect whenever there is new application in tasklist i.e. when user opens any application.

Possible solutions and there drawbacks are given in the question that I posted. In this question, the perfect solution is to catch the startapplication calls in the launcher. I need to know how to do it.

Community
  • 1
  • 1
Faheem
  • 509
  • 2
  • 7
  • 23

0 Answers0