I got somewhere on the net following code, I tried to execute but it
throws "broken pipe: IOException" at

os.writeBytes(single + "\n"); line....


Following is the code..

Process process = Runtime.getRuntime().exec("su"); DataOutputStream?
os = new DataOutputStream?(process.getOutputStream());
DataInputStream? osRes = new DataInputStream?
(process.getInputStream()); for (String single : commands) {

os.writeBytes(single + "\n"); os.flush(); res.add(osRes.readLine());
} os.writeBytes("exit\n"); os.flush(); process.waitFor();


Any idea..
Please help...
Asif

On Feb 4, 6:23 pm, Asif k <asifk1...@gmail.com> wrote:
> Is it possible to spawn a new process from the activity with su mode
> and then run the script??
> i had given the shell script as bellow but does not give fruitful
> output,
>
> stored in the device: /data/local/hello.sh
> #!/system/bin/sh
> (ifconfig wlan0 up)su
> exit
>
> and form Java code,
>
> Process process = Runtime.getRuntime.exec("/data/local/hello.sh");
>
> Can anyone please help me on this????
>
> Thanks,
> Asif
> On Feb 4, 11:39 am, Asif k <asifk1...@gmail.com> wrote:
>
>
>
> > Hi all,
>
> >    I am running a shell script stored in the device from android
> > application by creating instance of Process class.
> >   But my script has commands which will be executed only in "su" mode.
> > any idea how to accomplish this?
>
> > Thanks,
> > Asif- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to