Android Question running the app with ROOT permission

yaniv hanya

Active Member
Licensed User
i built an app the send commands to ModBus protocol. the people that built the slave (the device that get the commands), says that the app have to grant a "root" permission for sending the commands.
how do i give the app ROOT permission? can it be done via the app menifest?
 

moster67

Expert
Licensed User
Longtime User
don't know if it is still relevant but see this thread:

There might be other examples in the forum how to obtain it - I didn't search that much...
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

yaniv hanya

Active Member
Licensed User
Are you all sure i have to root the device? the company that use the the BodBus send me a working apk of java and i don't sure the device it work on is rooted. (i can't check it on my phone since it required UART connector).
 
Upvote 0

yaniv hanya

Active Member
Licensed User
it should be a custom ROM, or i can create a certificate that will give SU permission? the process described here-

required ROOTED device?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
company that use the the BodBus send me a working apk of java and i don't sure the device it work on is rooted
If that is the case then they seem to be wrong about needing root permission - which would be a strange limitation for an app that, I assume, only needs to access a USB serial device..
 
Upvote 0

yaniv hanya

Active Member
Licensed User
well... the problem is that without this permission the bits doesn't go through to the microchip. I guess I wrong and the device is rooted. I only saw a video showing it. I"l investigate more.

But thanks all, I got my answers. You are great…
 
Upvote 0

yaniv hanya

Active Member
Licensed User
don't know if it is still relevant but see this thread:

There might be other examples in the forum how to obtain it - I didn't search that much...
it didn't wokred for me. i allways get "permission error", do any body have another idea?
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Opening statement from the SuperUser lib thread ...

Introduction

We all have seen various apps asking for superuser permissions to do weird things with our devices and many times we wondered how they do it. Well, with SupeUser, accessing a rooted device is as simple as a function call!
 
Upvote 0

yaniv hanya

Active Member
Licensed User
I"m sorry. i didn't explain myself. the device is rooted, and the superuser lib does recognize it as rooted. but the commands dosen't run. it gives error message- "permission denid", all though i think that in the menifest i gave all the permission needed.

however, since the superuser lib is old, i think i will not find a way to work it up. so, what i try to understand is how to build a superuser app from B4A. since the java exmple they send me does work. i wonder if it is possible from the app design, or it should be in the installation process only.
 
Upvote 0

yaniv hanya

Active Member
Licensed User
Eventually it opens /dev/ttySAC0. You can try to open it with File.OpenInput.
I tried this code as you suggested here and here
B4X:
    Dim out As OutputStream = File.OpenOutput("/dev/ttySAC0", "", False)

and that what i got
Error occurred on line: 53 (Main)
java.io.FileNotFoundException: /dev/ttySAC0 (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:448)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
If it works like that it would be great.
Do you have any idea what permission I need?
 
Upvote 0
Top