我想执行命令" pm grant com.example.xy android.permission.CHANGE_CONFIGURATION"在应用程序内部。
Process p;
try {
p = Runtime.getRuntime().exec("pm grant com.example.xy android.permission.CHANGE_CONFIGURATION");
p.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
while ((line = reader.readLine())!= null) {
output.append(line + "n");
Log.e("splash", "error " + output.append(line + "n"));
}
} catch (Exception e) {
Log.e("splash", "error " + e.toString());
e.printStackTrace();
}
String response = output.toString();
return response;
这没有效果。 有谁有解决方案吗?