Android 如何在每秒钟后终止一个进程?

Android 如何在每秒钟后终止一个进程?,android,process,kill-process,Android,Process,Kill Process,如何在每秒钟后终止进程。我想设置一个计时器,该计时器将每秒检查进程是否已启动,并通过其包名继续终止该进程。在java中,您不应该终止线程 你能做的就是 Thread thread = new Thread(); //this you should do when you declare your thread after creating thread object. thread.setDaemon(true); //要杀死你的线程,请使用此 thread.inte

如何在每秒钟后终止进程。我想设置一个计时器,该计时器将每秒检查进程是否已启动,并通过其包名继续终止该进程。在java中,您不应该终止线程

你能做的就是

    Thread thread = new Thread();
    //this you should do when you declare your thread after creating thread object.
    thread.setDaemon(true); 
//要杀死你的线程,请使用此

thread.interrupt();
thread = null;
要杀死其他应用程序进程,请使用

    android.os.Process.killProcess(thread_id);

在java中,不应该终止线程

你能做的就是

    Thread thread = new Thread();
    //this you should do when you declare your thread after creating thread object.
    thread.setDaemon(true); 
//要杀死你的线程,请使用此

thread.interrupt();
thread = null;
要杀死其他应用程序进程,请使用

    android.os.Process.killProcess(thread_id);

感谢您的帮助,但我不想杀死我自己的进程或线程我想执行此操作杀死其他应用程序和其他进程Shelp感谢您,但我不想杀死我自己的进程或线程我想执行此操作杀死其他应用程序和其他进程出于上帝的爱,您为什么要这样做?除了每秒持续运行你的应用程序会消耗大量的电池外,如果没有系统签名,我不相信你还能杀死不再属于你自己的进程。看在上帝的份上,你为什么要这么做?除了每秒持续运行应用程序会消耗大量的电池外,我认为如果没有系统签名,你将无法杀死不再属于你自己的进程。