Saturday, 15 February 2014

Automatic adb install apks files to your phone if you are tired by do it manually - java snippet

This short snippet will help you a lot (I hope so). If you have apps on hardrive  you can speed up installing your apps and save some time.

 public class Main {  
   public static final int SECOND_DELAY = 10;  
   public static final String path = "C:\\Users\\michal\\Dropbox\\android\\back\\";  
   public static void main(String[] args) throws IOException, InterruptedException {  
     new Main().doStuff();  
   private void doStuff() throws IOException, InterruptedException {  
     File file = new File(path);  
     Runtime rt = Runtime.getRuntime();  
     for(File f: file.listFiles())  
       String command = "adb install -r " + "\"" + path + f.getName() + "\"";  
       Process pr = rt.exec(command);  
       long timeDelay= SECOND_DELAY * 1000;  

As you see this snippet automatic installs your apks from specific path with specific second_delay. Thanks for attention :)