Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Getting Started with BlackBerry® Smartphone Development – BlackBerry® Smartphone SDK – Java Contents Overview ............................................................................................................................................................................. 2 Target Audience ................................................................................................................................................................ 2 Feedback............................................................................................................................................................................. 2 System Prerequisites ....................................................................................................................................................... 3 Installations ......................................................................................................................................................................... 4 See Also ............................................................................................................................................................................ 11 Overview This document describes the end to end process of designing, packaging, deploying and running a BlackBerry® application using the ZebraLinkTM Multiplatform SDK and Smartphone Utility. The sample code used in this guide is from the “Sending File” sample code article (SA122) which is available for download to all registered members of the Zebra ISV Program here on the Zebra Support Portal. For information on joining the ISV Program contact a Program manager in your area. Details here. This file is available in a Spanish-language version here. Este archivo esta disponible en Español - oprima aquí. This file is available in a Portuguese-language version here. Este ficheiro está disponível na versão Portuguesa, clique aqui. Target Audience The information delivered in this document assumes the reader has reasonable technical competence covering Microsoft Windows, Java development with the Eclipse Integrated Development Environment (IDE), and core programming concepts and rationales. Feedback We value all feedback. Please rate the article and then add your comments/suggestions in the text field that appears. System Prerequisites The following system prerequisites must be satisfied in order to complete this tutorial. Java Development Kit (JDK) version 6 To develop BlackBerry® applications, you need to install this version of the JDK. To download the JDK, click here. Eclipse version 3.5 (Galileo) IDE for Java Developers Eclipse Galileo is the IDE used to develop BlackBerry® applications such as the one featured in this whitepaper. To download the IDE, click here. BlackBerry® Java Plug-in for Eclipse The BlackBerry® Java Plug-in for Eclipse is designed to give you a powerful, integrated environment in which to build BlackBerry® applications. For more information on installing the BlackBerry® Java Plug-in for Eclipse, click here. BlackBerry® Java SDK 4.5.0.28 This SDK contains the proper components and JRE to develop the sample application in this whitepaper. Zebra Multiplatform SDK The Zebra Multiplatform SDK contains all the required components to develop applications for Zebra label printers. The SDK includes a Java library (.jar) which provides the means to discover, connect, and print to Zebra label printers. For more information, including system prerequisites and download links for Zebra Multiplatform SDK, click here. Code Signing Keys Since the .jar file in the Zebra Multiplatform SDK uses controlled classes, the application that references it must be signed using a signature key (provided by RIM) before you can load the application .cod files onto the BlackBerry® Smartphone. For more information on Code Signing Keys, click here. Zebra Bluetooth-Enabled Label Printer In order to fully test the application created during the course of this tutorial, a Bluetooth-enabled Zebra printer capable of understanding ZPL or CPCL. Network connectivity is also available through the Zebra Multiplatform SDK and covered in other available tutorials. BlackBerry® Device It is recommended that all development is fully tested against a physical device. Note: For the list of printers and mobile devices that are supported by the Zebra Multiplatform SDK, click here. BlackBerry® Desktop Software This is the software application that will be used to load the application onto the BlackBerry® device. For more information on installing the BlackBerry® Desktop Software, click here. Installations All the items listed in the “System Prerequisites” must be installed. The default installation options for all these prerequisites are satisfactory. Creating Your First Zebra Mobile Application You will be guided on how to create a mobile application that allows the handheld device to establish a Bluetooth connection with a Zebra mobile printer and sends a file to it. 1. Launch the Eclipse IDE. Enter your desired workspace path. For the purpose of this whitepaper, we shall use “c:\MyFirstZebraBlackBerryApp” 2. Create a BlackBerry project. a. Go to File -> New -> Other -> Blackberry -> BlackBerry Project and click Next > b. Enter “BlackBerrySendFile” as the project name c. Select “BlackBerry JRE 4.5.0” as the project specific JRE and click Finish 3. Add ZSDK_API.jar to project. a. Open your BlackBerrySendFile project b. Drag "[Install Dir]\blackberry\[build version]\ZSDK_API.jar" into the root of the project (where [Install Dir] is the directory chosen during the installation process, and [build version] corresponds to the desired build). c. Right click on the project, and select "Build Path > Configure Build Path..." d. Select the "Libraries" tab e. Click the "Add JARs..." button f. Locate the ZSDK_API.jar file in your project, and click "OK" g. Select the "Order and Export" tab h. Enable the checkbox next to the ZSDK_API.jar entry i. Click "OK" to exit the dialog j. The ZSDK_API.jar file will be listed under Referenced Libraries folder 4. Add Java Package to project. a. Right-click on your BlackBerrySendFile project b. Go to New then click Package c. Enter “com.zebra.isv.sendfiledemo” as the Name and click Finish 5. Add .java files to project The sample code used in this guide is from the “Sending File” sample code article (SA122) which is available for download to all registered members of the Zebra ISV Program here on the Zebra Support Portal. For information on joining the ISV Program contact a Program manager in your area. Details here. a. Replace the contents of the "ColorfulLabelField.java" file with the contents of the "ColorfulLabelField.java" file from the "Sending File" sample application (SA122). b. Replace the contents of the "ConnectionScreen.java" file with the contents of the "ConnectionScreen.java" file from the "Sending File" sample application (SA122). c. Replace the contents of the "CustomObjectListField.java" file with the contents of the "CustomObjectListField.java" file from the "Sending File" sample application (SA122). d. Replace the contents of the "DemoMainScreen.java" file with the contents of the "DemoMainScreen.java" file from the "Sending File" sample application (SA122). e. Replace the contents of the "DemoSleeper.java" file with the contents of the "DemoSleeper.java" file from the "Sending File" sample application (SA122). f. Replace the contents of the "EnablableBasicEditField.java" file with the contents of the "EnablableBasicEditField.java" file from the "Sending File" sample application (SA122). g. Replace the contents of the "SendFileDemo.java" file with the contents of the "SendFileDemo.java" file from the "Sending File" sample application (SA122). 6. Build and run the application. a. Right-click the “BlackBerrySendFile” project, select Run As -> BlackBerry Simulator. This runs the application in a BlackBerry simulator. The simulator might take a while to start up depending on the available computer resources and hardware. b. In the simulator, go to Applications, and then go to a black window icon labeled “BlackBerrySendFile” to run the application. c. Congratulations. You now have your first Zebra mobile application running on a simulator! Note that the Bluetooth connectivity may not be correctly simulated. The application should be tested on a physical device, which will be covered in the next section. To exit the simulator, Go to File -> Exit. Also note that a new directory called “deliverables” has been created in your project. This directory contains deployment files for the application. Deploying Your Mobile Application After your project is completed, its .cod file may be loaded on a BlackBerry® device to deploy the application. However, the application needs to be signed first with a signature key. 1. Sign the application a. Right-click on your BlackBerrySendFile project then go to BlackBerry -> Sign with Signature Tool….. The Signature Tool will appear. b. Click on the Request button c. Enter your private key password and click OK d. Now the application is signed. Click Close. 2. Load the application onto the device a. Connect your BlackBerry® device to your PC b. Run the BlackBerry® Desktop Software c. Enter password if prompted then click OK d. Go to Applications. After the Applications list loads, scroll down until you see “BlackBerrySendFile” listed. e. Click the “+” button next to “BlackBerrySendFile” f. Click Apply The BlackBerry® Desktop Software will then load the BlackBerrySendFile app to your device See Also For further Zebra SDK enabled Blackberry sample code and applications, refer to the Zebra Support Portal. For the list of printers and mobile devices that are supported by the ZebraLink Multiplatform SDK, click here. For further information on ZPL, see the ZPL Programming Guide on the Zebra website. For further information on CPCL, see the CPCL Programming Guide on the Zebra website. For any further information, sample code, white papers and solutions or to request further content, visit the Zebra Support Portal. Document Control Version Date Description 1.0 1.1 2.0 2-Dec-10 7-Mar-11 16-Sep-12 Initial Release Updated to remove code sections Updated Spanish and Portuguese link into document All links and information correct at time of writing Created for the Zebra Global ISV Program by Zebra Development Services *Specifications subject to change without notice. ©2009 ZIH Corp. EPL, APL, ZBI 2.0, ZBI-Developer, Element Energy Equalizer, E 3, ZebraLink, EPL2, ZebraNet, and all product names and numbers are Zebra trademarks, and Zebra, the Zebra head graphic stripe, ZPL, ZebraNet, and ZPL II are registered trademarks of ZIH Corp. All rights reserved. Unicode is a trademark of Unicode, Inc. CG Triumvirate is a trademark of Agfa Division, Miles In c. IBM is a registered trademark of International Business Machines Corporation. UFST is a trademark of Monotype Imaging Inc. a nd may be registered in certain jurisdictions. All other trademarks are the property of their respective owners. Corporate Headquarters +1 800 423 0442 E-mail: [email protected] Other Locations Asia-Pacific Headquarters +65 6858 0722 E-mail: [email protected] EMEA Headquarters +44 (0)1628 556000 E-mail: [email protected] Latin America Headquarters +1 847 955 2283 E-mail: [email protected] USA: California, Georgia, Rhode Island, Texas, Wisconsin Europe: France, Germany, Italy, Netherlands, Poland, Spain, Sweden Asia Pacific: Australia, China, Japan, South Korea Latin America: Argentina, Brazil, Florida (USA), Mexico Africa/Middle East: India, Russia, South Africa, United Arab Emirates GSA#: GS-35F-0268N 13919L-001 Rev. 9 (11/08)