• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Mods Root access not work in Android! new File( [Root only]

My phone - rooted Android 4.2. Popular file managers work well with directory like "/config" or "/data". But in my program I can't observe this directories.

I use library RootTools

if (RootTools.isRootAvailable()) {
if (RootTools.isAccessGiven()) {
new File("/config").listFiles();//null
}
}

I see window with confirm "get root access" and push "yes". And I add in manifest

<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
 
jandorwizard,

I'm guessing the issue you're experiencing is that those directories are secured against reading and therefore from revealing their contents via the normal Java File().listFiles() API.

The reason is that your app itself does not have direct root access (i.e., it doesn't run as the root user), but is simply granted access to the su binary.

I'd also guess that those other apps use the su shell to list the files (via an ls command) in those protected directories when they are encountered.

Hope that helps!
 
Back
Top Bottom