android how to kill a process or an app and detect some app restart again

Recently,When I use some security applications,I find those application can kill others applications,but when I read api,the android just support some api to kill application itself,it doesn't support any other api directly to kill any process or application in phone.So how those security applications can kill other applications?Do those guys use some functions like linux "kill" system call?And I also find those security applications can clean RAM,Do they clean memory by killing app?The last question is some application can start itself when phone started,those some security applications can avoid this situation happening?But as I known,those applications register bootcompletion broadcastreceiver,so how security applications make those receiver disable?I hope someone who has experience on those areas can help me solve these questions,thanks a lot:)

Answers


You can kill some processes with:

   public void killSelf(Context context) {
            ActivityManager am = (ActivityManager) context
                            .getSystemService(Activity.ACTIVITY_SERVICE);
            am.killBackgroundProcesses(getPackageName());

            if (mServiceList != null) {
                    for (RunningServiceInfo service : mServiceList) {
                            context.stopService(new Intent().setComponent(service.service));
                    }
            }
    }

More detail, you can see my personal project about TaskManager,here is source code: http://code.google.com/p/my-test-project-lion/


Need Your Help

UIAlertView is Not Working in Swift

ios uialertview swift

when i runt this code in swift, i dont know why the app terminates by showing a break point in the "alertView.show()" part, Somebody please help me.

Center aligning textbox in div

html css

I am trying to align my text and textbox to center of the div. My main div is centered because of margin:0 auto. But I applied this to textbox and its not working.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.