Parental Control in Android

2.5k views Asked by At

How to implement parental control in my application i.e when my application starts, all the other applications should stop running. plz help me.

1

There are 1 answers

2
salman khalid On BEST ANSWER

Yes it is possible.Retrieve the name of running processes and their UIDs and then kill those processes which you want to stop.e.g If u want to stop browser app you can do this in this way.

ActivityManager servMng;
servMng = (ActivityManager)getApplicationContext().getSystemService(ACTIVITY_SERVICE);
                List<ActivityManager.RunningAppProcessInfo> list = servMng.getRunningAppProcesses();
                if(list != null){
                 for(int i=0;i<list.size();++i){
                  if("com.android.browser".matches(list.get(i).processName)){
                   int pid = android.os.Process.getUidForName("com.android.browser");
                         android.os.Process.killProcess(pid);
                  }else{
                   mTextVIew.append(list.get(i).processName + "\n");
                  }
                 }
                }