Root privileges for an android application (Complete app. Not just few commands)
Asked Answered
E

1

10

Question :

How to execute one complete app with root previleges (not just few commands)?


Scenario :

I am working on a rooted android device.

In an android app, I need to play the H.264 stream received through eth0. I need root privileges to open (raw open) eth0.

The corresponding code is in JNI. Since there are a lot of buffers that need to be exchanged between JNI code and Java code, the executable way(Process.exec(su)) is very inconvenient.


Ideal solution:

The JNI code is executed in the same process context as of the Java code. Therefore, granting root privileges to my android process should solve my problem. But I am not sure how to do that.


I tried :

  1. Making the application as system app/priv-app. I thought this will give the app root access. But that did not happen.
Endocrinotherapy answered 25/8, 2016 at 3:7 Comment(1)
in your manifest you should have this (btw what version/s are you using ?)<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>Sister
I
0

Try moving your application from /system/app to /system/priv-app.

Applications in /system/priv-app will have system level access.

/system is read-only without root so it prevents uninstalling applications from /system/app and /system/priv-app. Applications that are critical are put there so that they can't be uninstalled.

/system/priv-app allows apps installed there to use signatureOrSystem and other privileged permissions.

Irresistible answered 29/8, 2016 at 11:2 Comment(6)
Thank you. But I still face the same issue. "Operation not permitted" After moving to priv-app, should I request for system permissions by declaring something in XML?Endocrinotherapy
Add the below line in manifest android:sharedUserId="android.uid.system" and sign the app using platform certificate. #3635601Irresistible
Added that. But still the issue remainsEndocrinotherapy
Any progress with that?Cerebration
@Cerebration No. Finally I am using socket IO between JNI and java.Endocrinotherapy
@mk.. I also ended up using a socket between C++ code that runs as root and my Java app.Cerebration

© 2022 - 2024 — McMap. All rights reserved.