在android系统中结束进程的方法有好几种,但是使用后都不太理想。

今天在网上Search,找到一个方法,记录下来。

ActivityManager sd = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
Method method
= Class.forName("android.app.ActivityManager").getMethod("forceStopPackage"String.class);
method.invoke(sd, "包名");

在androidmainifest.xml中加入权限
 <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/>



相关文章:

  • 2021-12-25
  • 2022-01-29
  • 2021-12-07
  • 2022-12-23
  • 2021-08-14
猜你喜欢
  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案