Tutorial: BlackBerry Object API Application Development Sybase Unwired Platform 2.
DOCUMENT ID: DC01214-01-0222-01 LAST REVISED: January 2013 Copyright © 2013 by Sybase, Inc. All rights reserved. This publication pertains to Sybase software and to any subsequent release until otherwise indicated in new editions or technical notes. Information in this document is subject to change without notice. The software described herein is furnished under a license agreement, and it may be used or copied only in accordance with the terms of that agreement.
Contents Sybase Unwired Platform Tutorials ......................................1 Getting Started with Unwired Platform ................................3 Installing Sybase Unwired Platform ................................3 Starting Sybase Unwired Platform Services ...................3 Starting Sybase Unwired WorkSpace ............................4 Connecting to Sybase Control Center ............................4 Learning Sybase Unwired WorkSpace Basics ...............5 Developing a BlackBerry Application .
Contents iv Sybase Unwired Platform
Sybase Unwired Platform Tutorials Sybase Unwired Platform Tutorials The Sybase® tutorials demonstrate how to develop, deploy, and test mobile business objects, device applications, and Hybrid App packages. You can also use the tutorials to demonstrate system functionality and train users.
Sybase Unwired Platform Tutorials 2 Sybase Unwired Platform
Getting Started with Unwired Platform Getting Started with Unwired Platform Install and learn about Sybase Unwired Platform and its associated components. Complete the following tasks for all tutorials, but you need to perform them only once. Installing Sybase Unwired Platform Install Sybase Mobile SDK and Unwired Platform Runtime. Before starting this tutorial, install all the requisite Unwired Platform components. See the Sybase Unwired Platform documentation at http://sybooks.sybase.
Getting Started with Unwired Platform Starting Sybase Unwired WorkSpace Start the development environment, where you can create mobile business objects (MBOs), manage enterprise information system (EIS) datasources and Unwired Server connections, develop Hybrid App applications (Hybrid Apps), and generate Object API code. Select Start > Programs > Sybase > Unwired Platform > Sybase Unwired WorkSpace. The Sybase Unwired WorkSpace opens in the Mobile Development perspective.
Getting Started with Unwired Platform Learning Sybase Unwired WorkSpace Basics Sybase Unwired WorkSpace features are well integrated in the Eclipse IDE. If you are unfamiliar with Eclipse, you can quickly learn the basic layout of Sybase Unwired WorkSpace and the location of online help. • • • To access the online help, select Help > Help Contents. Some documents are for Sybase Unwired Platform, while others are for the Eclipse development environment.
Getting Started with Unwired Platform Window Description Mobile Application Diagram The Mobile Application Diagram is a graphical editor where you create and define mobile business objects. Use the Mobile Application Diagram to create MBOs (including attributes and operations), then define relationships with other MBOs. You can: • Create MBOs in the Mobile Application Diagram using Palette icons and menu selections – either bind or defer binding to a datasource, when creating an MBO.
Getting Started with Unwired Platform Window Description Problems view Displays validation errors or warnings that you may encounter in addition to errors in the Diagram editor and Properties view. Follow warning and error messages to adjust MBO properties and configurations to avoid problems, and use as a valuable source for collecting troubleshooting information when reporting issues to Customer Service and Support. Error Log view Displays error log information.
Getting Started with Unwired Platform 8 Sybase Unwired Platform
Developing a BlackBerry Application Developing a BlackBerry Application Generate code for the BlackBerry platform, develop a BlackBerry device application using that code and sample files, and test the application's functionality on a simulator. Prerequisites Note: This tutorial was created using Sybase Unwired Platform 2.2 SP02, BlackBerry Java SDK 7.1.0.10, BlackBerry Java Plug-in (core) 2.0.0, and run on an BlackBerry SDK 9900 device emulator. If you use a different version, some steps may vary. 1.
Developing a BlackBerry Application 1. Confirm that your system meets the requirements at https://developer.blackberry.com/ java/download/eclipse/. 2. Start Sybase Unwired WorkSpace, then select Help > Install New Software. 3. In the Available Software window, click Add. 4. In the Add Repository dialog, enter BlackBerry Plugin for the name and http:// www.blackberry.com/developers/jar/win/java for the location. Click OK. 5.
Developing a BlackBerry Application 4. In the Generate Code wizard, click Next to select the default configuration and continue without any changes. 5. In the Select Mobile Business Objects window, select the Customer MBO, then click Next. Ignore any warning about unresolved mobile business object dependencies. 6. In the Configure Options window, specify these values and click Finish. Option Description Language Select Java. Platform Select Java ME for BlackBerry.
Developing a BlackBerry Application You can ignore the error icons that appear in WorkSpace Navigator under SUP101\Generated Code\BlackBerry\src\, and the error in the Problems view: net cannot be resolved. The error occurs because the package Java file called by SUP101DB.jar is not yet in the project build path. The errors resolve later, when you build the application in the BlackBerry Java Plug-in for Eclipse. 7. In the Success dialog, click OK.
Developing a BlackBerry Application Creating the BlackBerry Project Create a new BlackBerry project in Unwired WorkSpace. Add library resources to the project and set other application properties. Prerequisites To help create your project, and in a subsequent topic, build the user interface, download the SUP101 BlackBerry Object API (2.2 SP02) example project from the SAP Community Network (SCN) Web site at http://scn.sap.com/docs/DOC-8803. Task 1. Start Unwired WorkSpace. 2. Select File > New > Project.
Developing a BlackBerry Application 9. If prompted to use a different perspective, click No. Configuring BlackBerry Application Properties Modify the BlackBerry application description to define the general BlackBerry properties used in an application. 1. In WorkSpace Navigator, expand the SUP101BlackBerry project. 2. Double-click the BlackBerry_App_Descriptor.xml file. 3. Select the Application tab. 4. In the Title, enter SUP101 BlackBerry. 5. (Optional) Enter a version, vendor, and description.
Developing a BlackBerry Application 6. Select File > Save. Copying Unwired Platform Files to the Sample Project Copy Unwired Platform BlackBerry runtime files and the object API code you generated using the Generate Code wizard to the SUP101BlackBerry project. 1. In Windows Explorer, browse to SUP_HOME\MobileSDK22\ObjectAPI\BB. 2. Copy the UltraLiteJ12.cod file. 3. Paste the copied COD file into the BlackBerry Java Plug-in simulator directory, located in SUP_HOME\MobileSDK22\Eclipse\plugins \net.rim.ejde.
Developing a BlackBerry Application Creating the User Interface Copy the Java code files, which provide the functionality and layout of the user interface, from the SUP101 BlackBerry Project example project archive to the SUP101 BlackBerry project. 1. In Windows Explorer, browse to the directory where you saved the SUP101 BlackBerry Project example project file. 2. Copy these Java files: • CustomerDBCallback.
Developing a BlackBerry Application Creating a Launch Configuration for the Project Create a new launch configuration for the SUP101BlackBerry project. The configuration specifies how the application launches, and defines the target BlackBerry platform. 1. In WorkSpace Navigator, right-click the SUP101BlackBerry project, and select Run As > Run Configurations. 2. Select BlackBerry Simulator and the New launch configuration icon.
Developing a BlackBerry Application 3. In the Projects tab, select the SUP101BlackBerry project. 4. In the Name field, enter SUP101BlackBerry. 5. In the JRE tab, select the Project JRE (BlackBerry JRE Version). 6. In the Simulator tab, select Launch Mobile Data System Connection Service (MDSCS) with simulator. Then select BlackBerry-SDK - Version as the device. If you are running the BlackBerry JDE 7.0 with the BlackBerry Java Plug-in v1.
Developing a BlackBerry Application MDS starts, and you can now launch the BlackBerry simulator. Leave the command window open. 7. In the Network tab, verify that Disable Registration is selected. If it is not, the sample application cannot get data from Unwired Server. 8. Click Apply, then Close. Testing the Device Application on the BlackBerry Simulator Run the SUP101BlackBerry application on the BlackBerry simulator, and change customer information to update the interface. 1.
Developing a BlackBerry Application 2. On the main window, click All to access the applications screen, then scroll until you see the SUP101BlackBerry application.
Developing a BlackBerry Application 3. Click SUP101 BlackBerry to launch the application.
Developing a BlackBerry Application The application registers and synchronizes data from the server in the background. During initialization, the system enables the operation to target change notifications using: SynchronizationGroup sg=SUP101DB.getSynchronizationGroup("default"); sg.setEnableSIS(true); sg.save(); After the application initializes, the device application shows the SUP101BlackBerry application with a list of customer data.
Developing a BlackBerry Application 4. Select the customer to update.
Developing a BlackBerry Application 5. Change the first name of the customer and click submit.
Developing a BlackBerry Application The submit button maps to the update operation of the customer mobile business object. The synchronize operation uses SUP101DB.beginSynchronize in the background so the user interface is not affected. When the application synchronizes, any pending operations are uploaded to Unwired Server. Any back-end changes initiate notifications from the server. The device application uses a ChangeLog API, specifically ObjectList changeLogs = SUP101DB.
Developing a BlackBerry Application 26 Sybase Unwired Platform
Learn More About Sybase Unwired Platform Learn More About Sybase Unwired Platform Once you have finished, try some of the other samples or tutorials, or refer to other development documents in the Sybase Unwired Platform documentation set. Check the Sybase® Product Documentation Web site regularly for updates: http:// sybooks.sybase.com/sybooks/sybooks.xhtml? id=1289&c=firsttab&a=0&p=categories , then navigate to the most current version.
Learn More About Sybase Unwired Platform • Developer Guide: Hybrid Apps Customize and automate: • Developer Guide: Unwired Server Runtime > Management API – customize and automate system administration features. Javadoc and HeaderDoc are also available in the installation directory.
Index Index sup-client2.jar 13 UltraLiteJ12.jar 13 A application properties 14 B BlackBerry application description 14 BlackBerry Java Plug-in for Eclipse installing 9 BlackBerry project, creating 13 BlackBerry simulator 19 build path 13 Java perspective 16 Java class, creating CustomerDBCallback.java 16 CustomerList.java 16 CustomerSample.java 16 CustomerSampleScreen.java 16 ObjectAPIUtil.java 16 Java Object API code, generating 10 L C COD files CommonClientLib.cod 15 MessagingClientLib.
Index Sybase Mobile SDK installing 3 Sybase Unwired Platform documentation resources 27 getting started 3 installing 3 Sybase Unwired WorkSpace basics 5 how to access online help 5 starting 4 Sybase Unwired WorkSpace basics 5 T troubleshooting information 5 tutorials 1 downloading 27 U UltraLiteJ12.cod 15 UltraLiteJ12.