Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9162213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:09:26+00:00 2026-06-17T14:09:26+00:00

I have an Android phone that has only su binary installed and it works,

  • 0

I have an Android phone that has only su binary installed and it works, meaning I can adb shell into the phone and run an ‘su’ command and I will be root.

When I try to run a command via code, it doesn’t seem to work no matter which way I try to run it. I’ve tried many different variants of the following command.

Runtime.getRuntime().exec("su -c ps");

When I run this command on another rooted phone with a Superuser.apk or SuperSU.apk app installed, I get a dialog asking if I want to allow it to run with root permissions. When the apks are not there, it never asks and the command never works.

I’ve tried installing the apks on the first phone but they don’t seem to do anything. So, as the original question asks –> Is there any way to run the elevated command from within the app without the SU apps installed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:09:28+00:00Added an answer on June 17, 2026 at 2:09 pm

    It might be because you need to pass the commands to su as parameters like this:
    su -c 'ls -l'
    Or you might need to specify the full path to su, but I don’t see why it wouldn’t work the way you have it:
    Runtime.exec("/system/bin/su -c ps")
    Or maybe
    Runtime.exec("/system/bin/su -c \'ps\'")

    Try checking the output of this command too: System.getenv("PATH")

    Another variant could be Runtime.exec("su -c \'ls -s \'")
    Make sure you don’t forget to escape the single quotes as they are part of the actual String.

    Thats the way that I’ve found works most consistently, and it has also worked on devices that don’t have Superuser or SuperSU installed, as those apps only listen for the Broadcast that is sent out when an application tries to run a command as root. @Boardy SuperSU and Superuser intercept the broadcast and so act as a middle man between the app and root privileges, but its not necessary for a rooted device. It IS necessary if you want to have more control over the applications that are running commands as root, but even then it still only limits you to deciding which applications, not which commands, are given root privileges.

    Also, you might wanna take a look at RootTools and more specifically, the RootTools.isAccessGiven() command, which requests root privileges for your app.

    Source: Launch a script as root through ADB

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have android.permission.READ_OWNER_DATA but I can't find any reliable code that would explain how
I have a an Android ListView that has small (say, 1-5 frame) stutters as
I have an MP3 file that I can play outside of Android and stored
My goal is to have an Android phone (Samsung Galaxy Nexus) communicate with a
I have this code on my Android phone. URI uri = new URI(url); HttpPost
I have developed and published an Android application on the Android market. The phone
I have Android client app that communicates with server using Socket . On my
I have Android pet-project DroidIn which utilizes HttpClient 4 (built into Android) to do
I am aware that this question has been asked before, but I have tried
If you own Android phone you are no doubt have noticed how in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.