How To – Wirelessly deploy an application to a BlackBerry Playbook in developer mode

by BlackBerry Development Advisor (Retired) on ‎07-07-2011 03:45 PM - edited on ‎07-07-2011 03:45 PM by BlackBerry Development Advisor (Retired) (3,535 Views)

 

This article applies to the following:

  • BlackBerry® Tablet OS

 

Details:

 

The BlackBerry Tablet OS SDK comes pre-packaged with a full set of command line tools for compiling, packaging, signing and deploying applications for the BlackBerry Tablet OS.  To simplify the development and testing cycle, BlackBerry-deploy command line tool allows you to wirelessly deploy your application to a BlackBerry® PlayBook™ tablet when set in developer mode.

To deploy a BlackBerry Playbook tablet application wirelessly to a BlackBerry Playbook tablet using BlackBerry-deploy you would:


1.     Set the device in developer mode: Options > Security > Development Mode > Switch ON

 Developer Mode


 

 

 

 

 

 

 

 

untitled2.JPG

 

2. Check the IP address of your BlackBerry Playbook tablet.


pic3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3.     Provide the developer mode password and ip address to the blackberry-deploy command line tool

Ex. blackberry-deploy -installApp -password mypassword -device 10.191.232.35 -package myApp.bar

 

Note: Depending on the development model of your choice (Adobe AIR or WebWorks), step-by-step instructions guiding you through the development and deployment process can be found in the BlackBerry Tablet OS getting started guide http://us.blackberry.com/developers/tablet/

 

 

If are working on multiple projects and frequently find yourself deploying BlackBerry tablet applications, you can simplify  your testing and deployment by wrapping this process to produce a web page that can be navigated to by the BlackBerry Playbook tablet.  The below browser screenshot and JSP code produces this web page that can be run on a web server (i.e IIS, Apache® Tomcat) and allow a user to navigate to the web page, select an application and have it wired or wirelessly deployed to your BlackBerry Playbook tablet. An example of this can be found below

.

Note: Blackberry Playbook tablet when connected to wifi needs to be reachable (i.e. same LAN) from your web server if wirelessly deploying an application. If this below web page is locally hosted on your PC, you can also tether your BlackBerry tablet via USB and have your PC locally assign an IP address.

 

pic4.JPG

 

 

...

String batchFile = request.getRealPath("/") + "bin\\blackberry-deploy.bat";

String barFile = request.getRealPath("/") + "UploadedBarFiles\\Sample.bar";

String arg1 = "-installApp";

String arg2 = "-device";

String arg3 = request.getRemoteAddr();

String arg4 = "-password";

String arg5 = "test";

String arg6 = "-package";

String arg7 = "\"" + barFile + "\"";

 

out.write("*********************** OTA Installing \"" + barFile + "\" ***********************<br/>");

String[] command = new String[] {batchFile, arg1, arg2, arg3, arg4, arg5, arg6, arg7};

Process proc = Runtime.getRuntime().exec(command);

new ReadBufferThread(new BufferedReader(new InputStreamReader(proc.getInputStream())), out).start();

new ReadBufferThread(new BufferedReader(new InputStreamReader(proc.getErrorStream())), out).start();

proc.waitFor();

 

...

 

final class ReadBufferThread extends Thread {

 

  BufferedReader br;

  Writer out;

 

  public ReadBufferThread(BufferedReader pBr, Writer pOut) {

    this.br = pBr;

    this.out = pOut;

  }

 

  public void run() {

       try {

                     String rline;

                     while((rline = br.readLine()) != null ) {

                     out.write(rline);

                     out.write("<br/>");

                     }

              } catch (IOException e) {

                     e.printStackTrace();

              }

  }

}

...