android 使用系统级别权限

java.lang.SecurityException: Neither user 10027 nor current process has android.permission.MODIFY_PHONE_STATE

 1、root手机,奇兔刷机助手

2、将app拷贝至/system/priv-app目录下

3、重启手机

 

 

 

附:

/**
* 应用程序运行命令获取 Root权限,设备必须已破解(获得ROOT权限)
*
* @return 应用程序是/否获取Root权限
*/
public static boolean upgradeRootPermission(String pkgCodePath) {
Process process = null;
DataOutputStream os = null;
try {
String cmd = "chmod 777 " + pkgCodePath;
process = Runtime.getRuntime().exec("su"); //切换到root帐号
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(cmd + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
return false;
} finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
}
}
return true;
}

 

posted on 2016-10-31 12:04  guangdeshishe  阅读(1458)  评论(0编辑  收藏  举报

导航