Note : This blog is only meant to show you how to start developing mobile applications with SUP. Most of the information provided here can be found in the online help onSyBooks Online. Do not hesitate to read the official documentation, it contains much more details and some great tutorials.
Developing Mobile Applications with Sybase Unwired Platform (3/3)
In this tutorial, we will use the Device Application Designer (DAD) to develop a mobile application for BlackBerry devices. This tool allows you to model the user interface of the mobile application so you don't have to develop the application using the native tools and language of the platform (i.e. Java for BlackBerry and C# for Windows Mobile).
BlackBerry Java Plug-in for Eclipse Installation
The DAD needs the BlackBerry development tools to generate an application for BlackBerry devices.
You can either install the plug-in from Sybase Unwired Workspace or download it from RIM website.
Note : you'll need to enter a BlackBerry Developer Zone id and password during the installation process so you should register here.
Start Sybase Unwired Workspace and select Install New Software from the Help menu then click on the Add button :
Type the URL : http://www.blackberry.com/go/eclipseUpdate/3.5/javainto the location text box and type BlackBerry Java Plug-in Update Site in the name text box :
Select the components you wish to install. You must select the BlackBerry Java Plug-in component and at least one BlackBerry Java SDK component :
Device Application Designer Configuration
Now we need to configure the DAD and specify the location of the BlackBerry devices simulators.
Select Preferences from the Window menu and expand the Sybase, Inc tree. Select BlackBerryin Sybase, Inc > Mobile Development > Device Application Designer > Devices :
Edit the items to specify the location of the simulators. For the BlackBerry Curve 8300 the path should look like :
Mobile Application Creation
Right click on the MyFlights project then select New > Device Application Designer. Choose the platform device target you want to create the DAD for and click on Finish :
Note : you could also automatically create a DAD with auto-generated content by right-clicking on the project and selecting Create Device Application Designer.
Search Flights Screen Creation
Click onStart in the Device Application Designer Introduction view to open the Flow Design view. Our flow does not contain any screen so let's create the first one. Create a new empty screen by selecting the Empty element in the Palette > Screens container and clicking in the Flow Design view :
Double click on the new screen to open the Screen Design view :
Use the Palette to add some controls to the screen by drag and drop. We'll need 3 Labels, 2 choices, 1 Edit Box and 1 Button :
Rename the controls via the Properties tab :
Remove the Back button from the navigation bar and align the button to the right by adjusting the properties :
In a real application, the list of airports would be retrieved from the backend (sairport table in your SAP backend) using a BAPI. For this tutorial we will manually add a couple of entries to the 2 choices :
At the end, this is what your screen should look like :
Flights Screen Creation
Now we need to create a couple of screens to display the flights. The DAD is able to create these screens automatically. Right click in the Flow Design view and select Flow Design > Add Mobile Business Object Screen. Click on Search, select the Flights MBO and click on OK :
The Flights, Flights Details and FlightAvail Details screens will be automatically created :
Edit the properties of the new screens to change the labels and choose which MBO fields will be displayed.
We want to synchronize the data and display the flights when the user clicks on the Submit button. To achieve this we need to create some actions for this button.
In the Search Flights screen, click on the Submit button then on the Button > Actions tab :
Click on the little button next to the New...button to create a new action :
First create a Synchronize action. Click on Search... in the following screen to select the Default Synchronization Group :
Check the Customize synchronization option and click on Configure... to map the synchronization parameters to the corresponding controls :
Now create a new Connection action to connect to the Flights screen :
The Submit button has now 2 actions :
When the user clicks on this button, the MBOs will be synchronized using the parameters provided in the Search Flights screen and the Flights screen will be displayed.
Device Application Generation
In the Flow Design view, right click and select Generate Device Application :
Accept the default settings and make sure the following options are checked then click on Finish :
The device application will be generated then the BlackBerry device and MDS simulators will be started. In the BlackBerry simulator, click on Applications then on your application icon to start the device application :
Select the airports and the flight date and click on the Submit button (use the BAPI_FLIGHT_GETLIST BAPI on the backend system to find valid parameters) :
The search results will be displayed on the Flights screen :
Click on one of the flights to display more details :
Click on the menu key then select Flight Availability to display the last screen :
The Device Application Designer is a nice tool and it can be used to quickly create basic applications or prototypes. However if you want to create a device application with a very nice UI, you may have to use another approach. Search the SUP documentation for "Custom Development" for more information (and tutorials). Note that you can develop applications for the iPhone with SUP using this method.