Home > Mobile >  How to check whether another application in android code has root access
How to check whether another application in android code has root access

Time:09-19

Mobile phone is the root of it, I want to be in code check whether another application performs a su the right to command, that is to say, check whether the application has a root, in what way

CodePudding user response:

Is not an application have ROOT access, but whether the device is ROOT, ROOT manager is added to the whitelist, apply themselves in addition to containing the implementation of the SU command code without any different place,

CodePudding user response:

reference 1st floor bigc2001 response:
ROOT access is not an application, it is whether the device is ROOT, ROOT manager is added to the whitelist, apply themselves in addition to containing the implementation of the SU command code without any different places,


Mobile phone is the root, a program include the application of the su command code, prompt dialog box will pop up a authorization, after the authorization, the application has a root, this time I'll write another program b, the program b how to check a is mentioned privileges the application, or didn't mention right?

CodePudding user response:

reference 1st floor bigc2001 response:
ROOT access is not an application, it is whether the device is ROOT, ROOT manager is added to the whitelist, apply themselves in addition to containing the implementation of the SU command code without any different places,


Program ever perform su this command, there must be some difference, because I have to use the su command in your program, and I play a mobile game is suggested I use the auxiliary, but actually I didn't, I repeated test, the original is my this contains the su command program, after I shielding su this line of code, the game is not prompt, I don't understand is that how to check the game

CodePudding user response:

 public static Boolean upgradeRootPermission (String pkgCodePath) {
Process Process=null;
DataOutputStream OS=null;
Boolean resBoolean;
Try {
String CMD="chmod 777 + pkgCodePath";
The process=Runtime. GetRuntime (). The exec (" su ");//switch to the root account
OS=new DataOutputStream (process. GetOutputStream ());
OS. WriteBytes (CMD + "\ n");
OS. WriteBytes (" exit \ n ");//withdraw from the root account, will not perform sticking machine
OS. The flush ();
ResBoolean=process. WaitFor ()==0;
} the catch (Exception e) {
return false;
} the finally {
Try {
If (OS!=null) {
OS. The close ();
}
Process. The destroy ();
} the catch (Exception e) {
}
}
Return resBoolean;
}

PkgCodePath is a package name, all the app install detection, look have root access app.

Was not tested,
  • Related