Android Question give root access to my process ?¿?

intera

Member
Licensed User
Longtime User
Hi

according to this:

http://stackoverflow.com/questions/7295873/how-do-i-request-root-access-in-android

could be possibly by "just" do it like that:
B4X:
Process p = Runtime.getRuntime().exec("su");

I have been looking in this forum and found this:

http://www.b4x.com/android/forum/threads/how-to-use-runtime-getruntime.23006/#post-133387

and Erel gave this answer:

1. Phone.Shell.
2. I think that the OS library provides this API. If not then it should be simple to get it with Reflection (I can help you with this). Note that this value is not really useful in most cases.


so I was wondering it is posible to give root access to my service(process) this way...and the most important how(because I can nott see on phone lib or OS lib the "runtime.getruntime.exec" commands...

Thanks in advanced
 

intera

Member
Licensed User
Longtime User
The answer in the Stackoverflow link is wrong. Read the comments there. You can easily run "su" with Phone.Shell (which actually calls
Runtime.getRuntime().exec)


However the result is that a new process will be created and only that process will have root access.

Uhmmm I see...
I tried to create the process on createService but it does not work...
So Erel do you any way to create a new process inside a sub to just be able to "turn off the screen " with the gotosleep function, that needs root privileges?
Thanks in advanced
 
Upvote 0

intera

Member
Licensed User
Longtime User
I think that it can only be done if you can run it through a shell script. For example if you find a native executable that does it
I see, so something like
B4X:
#su gotothHellandSleepNow
:D
Will have to keep searching ...thanks again
EDIT
well could not find it...but I found is pretty easy with the device manager lib(just edit the XML to only ask for lock screen permission and the run manager.lockscreen)...so this thread can be closed
Thanks again to all
 
Last edited:
Upvote 0
Top