1.增加权限
android.permission.FORCE_STOP_PACKAGES(需要系统权限)
2.调用
private voidcloseWPS(String packageName){
try{
ActivityManager m= (ActivityManager) getSystemService(ACTIVITY_SERVICE);
Method method = m.getClass().getMethod("forceStopPackage", String.class);
method.setAccessible(true);
method.invoke(m, packageName);
finish();
}catch(Exception e){
e.printStackTrace();
}
}
亲测有效