Install Android APK without prompt

后端 未结 2 1742
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 15:05

We are writing an Android app that shows ads on large screens. We have a backend where advertisers can select the ads, so they are updated almost instantly. Because there wi

2条回答
  •  不知归路
    2020-12-07 15:34

    You can simply use adb install command to install/update APK silently. Sample code is below

    public static void InstallAPK(String filename){
        File file = new File(filename); 
        if(file.exists()){
            try {   
                String command;
                command = "adb install -r " + filename;
                Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command });
                proc.waitFor();
            } catch (Exception e) {
            e.printStackTrace();
            }
         }
      }
    

    OR

    Please check http://paulononaka.wordpress.com/2011/07/02/how-to-install-a-application-in-background-on-android/

提交回复
热议问题