emulation - android emulator root access -


i need execute c program in app adding executable android project , building .apk. try execute program in application this:

    process result = runtime.getruntime().exec("su");     string cmd = "program_name";      dataoutputstream dos = new dataoutputstream(result.getoutputstream());     datainputstreamdis = new datainputstream(result.getinputstream());      dos.writebytes(cmd + "\n");     dos.writebytes("exit\n");     dos.flush(); 

i know need root access installed superuser.apk didn't work. there possible way this? btw code not extended should give @ way program should executed i'm running emulator android 4.2.1

edit: checking root permission first with

         process suprocess = runtime.getruntime().exec("su");           dataoutputstream os = new dataoutputstream(suprocess.getoutputstream());          datainputstream osres = new datainputstream(suprocess.getinputstream());           if (null != os && null != osres) {              os.writebytes("id\n");              os.flush();              string curruid = osres.readline();              boolean exitsu = false;              if (null == curruid) {                  log.d("root", "can't root access or denied user");             } 

i have got same problem you. can find many answers here , old , not working anymore (in new sdk).

i found best answer here says security tips of android not allowing developer have root access :

 central design point of android security architecture no application, default,  has permission perform operations adversely impact other applications,  operating system, or user. includes reading or writing user's private data (such  contacts or e-mails), reading or writing application's files, performing network access,  keeping device awake, etc. 

so access have under application layer permissions.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -