re-evaluate your design. elevating to root just for a copy indicates
something is really wrong with your design.
-Earlence
On Jul 11, 4:12 am, Lado Kumsiashvili <
herrl...@gmail.com> wrote:
> OK, but how to run then the code as root?
>
> Lado
>
> On 11.07.2012 01:07, Dianne Hackborn wrote:
>
>
>
>
>
>
>
> > No don't use a shell command at all, just write the Java code to copy
> > the file.
>
> > On Tue, Jul 10, 2012 at 11:56 AM, Lado Kumsiashvili
> > <
herrl...@gmail.com <mailto:
herrl...@gmail.com>> wrote:
>
> > Please note, cp ist not available on every device. Use cat filea >
> > fileb to copy things.
>
> > Lado
> > --
> > Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> > Endy Silveira <
endy.silve...@traceback.com.br
> > <mailto:
endy.silve...@traceback.com.br>> wrote:
>
> > Solved!
>
> > proc = Runtime.getRuntime().exec("su");
>
> > DataOutputStream os = new
> > DataOutputStream(proc.getOutputStream());
> > os.writeBytes("chmod 777 777 /mnt/sdcard/Myapk.apk" +"\n");
> > os.writeBytes("cp /mnt/sdcard/Myapk.apk
> > /app/data/Myapk.apk"+"\n");
> > os.writeBytes("exit\n");
> > os.flush();
> > os.close();
>
> > proc.waitFor();
>
> > Em ter�a-feira, 10 de julho de 2012 14h26min33s UTC-3, Endy
> > Silveira escreveu:
>
> > Hello,
>
> > I'm trying to copy a .apk file from /mnt/sdcard to
> > /data/app programmatically, but I can't get success!
>
> > What I'm doing:
>
> > proc = Runtime.getRuntime().exec("su");
>
> > DataOutputStream os = new
> > DataOutputStream(proc.getOutputStream());
> > os.writeBytes("chmod 777 /mnt/sdcard/Myapk.apk");
> > os.writeBytes("cp /mnt/sdcard/Myapk.apk /app/data/Myapk.apk");
>
> > At terminal emulator I do it and everything runs ok...
>
> > Someone know why this code doesn't work? Or another way to
> > do it?
>
> > Thanks in advance,
>
> > Endy
>
> > --
> > You received this message because you are subscribed to the
> > Google Groups "android-platform" group.
> > To view this discussion on the web visit
> >
https://groups.google.com/d/msg/android-platform/-/dAe1-McoI6EJ.
> > To post to this group, send email to
> >
android-...@googlegroups.com
> > <mailto:
android-...@googlegroups.com>.
> > <mailto:
android-platform%2Bunsu...@googlegroups.com>.
> > <mailto:
android-...@googlegroups.com>.
> > <mailto:
android-platform%2Bunsu...@googlegroups.com>.
> >
hack...@android.com <mailto:
hack...@android.com>