机器人由busybox的命令行安装APK默默地 [英] Android Install apk silently by busybox command-line

查看:217
本文介绍了机器人由busybox的命令行安装APK默默地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要静默安装apk文件在后台被BusyBox的命令。 I`ve看到了一些类似的问题,如,但我仍然不能得到工作我的code正确...

我有:

  1. 在我的apk文件需要安装在/sdcard/download/app.apk
  2. 在安装了BusyBox

code(非工作):

 字符串SSS = Environment.getExternalStorageDirectory()+/下载/+app.apk;
过程中安装;
。安装=调用Runtime.getRuntime()EXEC(/系统/ XBIN / busybox的分装+ SSS);
INT成功= install.waitFor();
 

如果我使用安装,而不是分装它复制文件很好。

P.S。 code以上正在执行AsyncTask的。没有错误,也没有任何反应... 请帮帮忙!

此外,我想这一点,但我真的越来越退出值139和无结果:

 工艺过程;
        流程=调用Runtime.getRuntime()EXEC(素)。
        DataOutputStream类OS =新DataOutputStream类(process.getOutputStream());
        os.writeBytes(下午安装/mnt/sdcard/app.apk\n);
        os.flush();
        os.writeBytes(退出\ n);
        os.flush();

        INT I = process.waitFor();
 

解决方案

很多很多Android设备的调查后,我意识到,这code是正确的,作品!

只是有一些问题,一个设备(三​​星Galaxy Tab 2 7.0 - 4.0.3 ICS)。也许这是ICS的一些奇怪的特性。更新固件4.1.2后(果冻豆)的问题已经解决了。

I want to install .apk silently in background by BusyBox command. I`ve seen some similar questions like THIS, but I still cant get working my code properly...

I have:

  1. My .apk I need to install on /sdcard/download/app.apk
  2. Root
  3. BusyBox installed

Code (not working):

String sss = Environment.getExternalStorageDirectory() + "/download/" + "app.apk";
Process install;
install = Runtime.getRuntime().exec("/system/xbin/busybox pm install " + sss); 
int success = install.waitFor();

If I use "install" instead of "pm install" it copies file well.

P.S. Code above is executing in AsyncTask. No errors, but also nothing happens... Please help!

Also I tried this, but I`m getting exit value 139 and no result:

        Process process;
        process = Runtime.getRuntime().exec("su");
        DataOutputStream os = new DataOutputStream(process.getOutputStream());
        os.writeBytes("pm install /mnt/sdcard/app.apk\n");
        os.flush();
        os.writeBytes("exit\n");
        os.flush();

        int i = process.waitFor();

解决方案

After a lot of investigations on many android devices I realized that this code is correct and works!

There was just some problem with one device (Samsung Galaxy Tab 2 7.0 - 4.0.3 ICS). Maybe that is some strange feature of ICS. After updating firmware to 4.1.2 (Jelly Bean) problem has been resolved.

这篇关于机器人由busybox的命令行安装APK默默地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆