I have root android device. I want to download and install another application through my Application. I have the SUPERUSER Application installed on my device.
After downloading complete I am using the following code for Application Installation.
Process p = Runtime.getRuntime().exec("su");
InputStream es = p.getErrorStream();
DataOutputStream os = new DataOutputStream(
p.getOutputStream());
final String libs = "LD_LIBRARY_PATH=/vendor/lib:/system/lib ";
final String[] commands = {libs + "pm install -r " + result,"reboot"
};
for (String command : commands) {
Log.d(LOG_TAG, " command : " + command);
os.writeBytes(command + "\n");
}
os.writeBytes("exit\n");
Log.d(LOG_TAG, " DataOutputStream.writebytes ");
os.flush();
The above coed is working in Android 4.0. But When i run the same code on Andorid 4.2.2. I run in to sceurity exception.
java.lang.SecurityException: Permission Denial: broadcast asks to run as user -1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS
How can I deal with this exception?
Thanking in an Anticipation,
Regards,
AK