B4A Library SuperUser: Acquiring root permissions, the easy way.

Silv

Member
Licensed User
Longtime User
I tryed to install tutorial apk. It grants SU and install apk without problems . But when the installation finish , android kills the procces and i get following error in log.

java.lang.IllegalThreadStateException: Process has not yet terminated: 581
at java.lang.ProcessManager$ProcessImpl.exitValue(ProcessManager.java:275)
at com.datasteam.b4a.system.superuser.Su$1.run(Su.java:192)
at java.lang.Thread.run(Thread.java:818)

How to fix that?
Thanks.
 

peacemaker

Expert
Licensed User
Longtime User
java.lang.IllegalThreadStateException: Process has not yet terminated

The same issue, with
B4X:
Sub Get_Scr As Bitmap
' Take a screenshot.
Dim su As SuShell
su.Execute("/system/bin/screencap -p " & File.DirRootExternal & "/img.png").WaitForCompletion

Dim bmp As Bitmap
bmp.Initialize(File.DirRootExternal, "img.png")
Return bmp
End Sub

Problem is only if to shoot not my app activity.
But http://www.b4x.com/forum/basic4andr...nning-shell-commands-superuser.html#post39820 this SU script - works OK !
 
Last edited:

koaunglay

Member
Licensed User
Longtime User
Thanks a lot friends! But it is not OK screen recorder for me. I also installed your test recorder apk. It also not OK for me. It always show can't play this video. And I can't find recorded video file in folder. Thank any way. Sorry for my English .
 
Last edited:

BarryW

Active Member
Licensed User
Longtime User
Can we use this library to turn on gps. Because erel said that it needs to root a device so we can turn on gps programically.

Tnx...
 

Horst Leistner

Member
Licensed User
Please could you tell me how to use the SuperUser Library to solve my following simple Problem.
I have a picture in /sdcard/DCIM/Camera an want to copy it to my external SD Card /storage/7831-5E32.
I get a Permission Denied Error despite I have rooted my Galaxy S7.
There are no problems in the case of copying in the opposite direction.

Greetings
Horst Leistner


Manifest:

AddPermission("android.permission.WRITE_SETTINGS")
AddPermission("android.permission.ACCESS_SUPERUSER")


Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Test")
Dim source,dest,filename As String
source = "/sdcard/DCIM/Camera"
dest = "/storage/7831-5E32"
filename = "2016.12.13_16.21.51.jpg"
End Sub

ERROR
java.io.FileNotFoundException: /storage/7831-5E32/2016.12.13_16.21.51.jpg: open failed: EACCES (Permission denied)
 

peacemaker

Expert
Licensed User
Longtime User
android.permission.write_external_storage ?
 

Horst Leistner

Member
Licensed User
Inserting "android.permission.write_external_storage" makes no difference, maybe because "/storage/7831-5E32" is not the same as "external storage"
DirRootExternal = /storage/emulated/0
DirDefaultExternal = /storage/emulated/0/Android/data/lei.TstCopy2/files
 

clarionero

Active Member
Licensed User
Longtime User

Hi. I think in Samsung devices you must change the XML file with the access permisions to write the SD Card. It's not only give Root permisions to your app with this library. Look at XDA web for XML file name to change.

https://forum.xda-developers.com/showthread.php?t=2671916
http://help.locusmap.eu/topic/fix-for-external-sd-card-on-marshmallow

Rubén
 

walmo

Active Member
Licensed User
Longtime User

I know this is a old thread but was struggling with this for a long time also.
For me the fix was to put ' & exit ' at the end of the command string
Thx
 

peacemaker

Expert
Licensed User
Longtime User
The lib file link in the start post is dead.
Lib file v.2.4 is attached.
 

Attachments

  • superuser.zip
    27 KB · Views: 519
Cookies are required to use this site. You must accept them to continue using the site. Learn more…