Viene visualizzato un errore durante l'esecuzione di questo codice e l'errore è "Accesso root rifiutato [java.io.IOException]: Errore nell'esecuzione exec(). Comando: [su] Funzionamento directory: Ambiente nulla: null"Errore "Accesso root rifiutato" nell'applicazione Android
try
{
suProcess = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
DataInputStream osRes = new DataInputStream(suProcess.getInputStream());
if (null != os && null != osRes)
{
// Getting the id of the current user to check if this is root
os.writeBytes("id\n");
os.flush();
String currUid = osRes.readLine();
boolean exitSu = false;
if (null == currUid)
{
retval = false;
exitSu = false;
Log.d("ROOT", "Can't get root access or denied by user");
}
else if (true == currUid.contains("uid=0"))
{
retval = true;
exitSu = true;
Log.d("ROOT", "Root access granted");
}
else
{
retval = false;
exitSu = true;
Log.d("ROOT", "Root access rejected: " + currUid);
}
if (exitSu)
{
os.writeBytes("exit\n");
os.flush();
}
}
}
catch (Exception e)
{
Log.d("ROOT", "Root access rejected [" + e.getClass().getName()
+ "] : " + e.getMessage());
}
Sto tentando di implementare un codice in cui ho bisogno di comprimere un video utilizzando Android ma non riesco a trovare alcuna API pertinente per farlo. Potresti guidarmi per favore? –