Actually, it's the update I need to do, does anyone know if it's possible to do this without user intervention? I just report that there is an update closing the application and updating itself. Thank you in advance.
Actually, it's the update I need to do, does anyone know if it's possible to do this without user intervention? I just report that there is an update closing the application and updating itself. Thank you in advance.
This is only possible with robotic devices.
public static boolean InstallAPK(String filename)
{
File file = new File(filename);
if(file.exists())
{
String path = file.getAbsolutePath().replace(" ", "\ ");
try
{
String[] command = new String[]
{
"/system/bin/su",
"-c",
"pm install -r " + path
};
String[] command2 = new String[]
{
"/system/xbin/su",
"-c",
"pm install -r " + path
};
String[] command3 = new String[]
{
"su",
"-c",
"pm install -r " + path
};
Process proc;
try
{
proc = Runtime.getRuntime().exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
int res = proc.waitFor();
String todo = "Resultado do Processo:";
String line;
while((line = br.readLine()) != null)
{
todo += "\n"+line;
}
if(res == 0 && todo.contains("Success"))
{
return true;
}
if(res == 0)
{
proc = Runtime.getRuntime().exec(command2);
br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
res = proc.waitFor();
todo = "Resultado do Processo:";
while((line = br.readLine()) != null)
{
todo += "\n"+line;
}
if(res == 0 && todo.contains("Success"))
{
return true;
}
if(res == 0)
{
proc = Runtime.getRuntime().exec(command3);
br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
res = proc.waitFor();
todo = "Resultado do Processo:";
while((line = br.readLine()) != null)
{
todo += "\n"+line;
}
if(res == 0 && todo.contains("Success"))
{
return true;
}
}
}
AddLog("SiletlyInstall", "Erro numero: "+res+"\n\nLog de Instalação:\n"+todo);
return false;
}
catch (Exception e1)
{
save(e1);
}
}
catch (Exception e)
{
save(e);
return false;
}
}
AddLog("SilentlyInstall", "Arquivo não existe :: "+filename);
return false;
}