pengwang
pengwang

Reputation: 19956

copy my app .apk to /system/app/ using code

i have read Push .apk to /system/app/ in HTC HERO know i can use adb to do this:

 host$ adb shell
 hero$ su
 hero# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
 hero# cat /sdcard/myApp.adk > /system/app/myApp.adk
 hero# mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system

but my app have root,and i want to use code put my app apk to the /system/app/,how to do ?

Upvotes: 1

Views: 1199

Answers (1)

blganesh101
blganesh101

Reputation: 3695

You can use shell commands from the java file

Process process = Runtime.getRuntime().exec("su");
DataOutputStream out = new DataOutputStream(process.getOutputStream());
out.writeBytes("mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system\n");
out.writeBytes("cat /sdcard/myApp.adk > /system/app/myApp.adk\n");
out.writeBytes("mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system\n");
out.writeBytes("exit\n");  
out.flush();
process.waitFor();

This should help you.

Upvotes: 1

Related Questions