Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refuses to work even though it has root. #169

Closed
rom4ster opened this issue Dec 18, 2023 · 1 comment
Closed

Refuses to work even though it has root. #169

rom4ster opened this issue Dec 18, 2023 · 1 comment

Comments

@rom4ster
Copy link

rom4ster commented Dec 18, 2023

So I have my project in Android studio and am attempting to run it on my ROOTED xperia 1 III on android 12.
I have attached the onCreate method. Originally I was simply running Shell.getShell but it just NEVER RAN. Like it would not even ENTER the callback. So I decided to use the Shell.isAppGrantedRoot() thing and it just keeps returning null. I DID go in and give this thing root in magisk. Every time I hit the run button this happens, even if the app already has magisk permissions before starting.

Any ideas on HOW FIX? Thanks :)

override fun onCreate(savedInstanceState: Bundle?) {

        runAsRoot("ls")
        Shell.enableVerboseLogging = true
        Shell.setDefaultBuilder(
            Shell.Builder.create()
                .setFlags(Shell.FLAG_REDIRECT_STDERR)
                .setTimeout(10)
        )
        println("START CREAT")
        super.onCreate(savedInstanceState)
        println("CREATION")

        try {
            while (
                Shell.isAppGrantedRoot() != true
            ) {
                println("WAITING FOR ROOT")
            }
            Shell.getShell {
                println("IN SHELL")
                if (!it.isRoot) {
                    println("NO ROOT")
                    Shell.cmd("ls").exec()
                }
                if (serviceBind == null) {
                    println("CREATING BIND")
                    makeService(this.applicationContext)
                }
            }
        } catch (e: Exception) {
            e.printStackTrace()
            throw e
        }



    }
    
`
    
    

    
@rom4ster
Copy link
Author

Solved by not trying to send the service thorugh the binder, apparently only a couple things can be sent through the binder. The FileSystem module is a better solution anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant