Android Install apk silently by busybox command-line

前端 未结 3 1699
猫巷女王i
猫巷女王i 2021-01-01 05:54

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

3条回答
  •  一整个雨季
    2021-01-01 06:38

    maybe this code will help you

    Process p = null;
    try
    {
        p = Runtime.getRuntime().exec("su");
        DataOutputStream outs=new DataOutputStream(p.getOutputStream());
    
        String cmd="pm install /mnt/sdcard/app.apk";
        outs.writeBytes(cmd+"\n");
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    

提交回复
热议问题