CSE-2041A
Net-Centric Computing

York University
Fall 2011
Project
BB PhoneBook App
  Overview

Welcome to the project. For the project, your team will develop a mobile app for the BlackBerry 9000 smart-phone for an “always-on” phonebook app.

due date 9:00pm Wednesday 7 December 2011 (close of lab), but by
9:00pm Friday 9 December 2011 (close of lab) is fine without penalty
teams a minimum of two, and a maximum of three, students per team
platform
  • client side: BlackBerry widget (WebWorks)
  • server-side: CGI and JDBC
  • IDE: Eclipse (Hellios) with BB plugins

The app enables a mobile user to interact with a phone book stored on an online database server, and shadowed locally on the BlackBerry smartphone.

Tuesday 29 November (Lab #8)

  1. Familiarize yourself with the project.

  2. Do the BB Widget Trial.

    • Get familiar with the Eclipse enviroment and BB simulator.

    • Check out your BB phone and load the app.

  3. Do the PIM Widget exercise.

  4. Start into the project.

Lab report: Send an email to godfrey@cse.yorku.ca with the subject “CSE2041 Lab #8 Report”. Say briefly in the email the fix you made for gender in the SIS app in the BB Widget Trial.

Tuesday 6 December (Project Lab)

  1. For the project.

  2. Work on the project before this too, of course!

The BB Phones

  • Each team has an assigned phone.

  • You can check your team's phone out from the lab monitor in #1006.

    • You will need to sign out the phone, and leave a valid ID with the monitor — a driver's licence, a York student card, ... — which you will get back when you return the phone.

    • Do not leave the building with the phone.

    • Tech staff will lock your CSE account if the phone goes missing.

 
  Requirements

Tthe app must support of the following use cases:

  • User to look up the phone number of a given name prefix.

  • User to edit or delete an entry returned by the look-up use case.

  • User to insert a new entry.

The app must use the online server whenever available, and falls back on the local database if there is no connectivity.

 
  Deliverables

You should deliver three things by the due date of this project.

  • The BlackBerry that was assigned to your team, with the app loaded on it.

  • Submit the project report.

    The report file — in pdf or doc formats — can be submitted using the command:

    submit 2041 proj report_file

    The report is meant to describe your execution of the project to someone who is familiar with the project; e.g. a fellow student who is also executing the same project, and writing a similar report. Hence, the report should focus on your own experience and efforts; i.e., what you actually did, rather than on general description. It is expected to be very brief, to the point, and made up of at most two pages (excluding source listings).

    The report should include three sections.

    1. overview. Describes the overall architecture, design, and implementation issues, and a self-assessment of any limitation or deficiencies,

    2. team. The cse# and name of each team member, an explanation of how the work was divided, and how was communication and consistency maintained, and the main lessons that were learned from this project,

    3. source files. Listings of all HTML, CSS, JS, Java, and CGI files that make up the project. Make sure the code is properly formatted.

  • Submit your project files.

    These include the following.

    1. widget source files. HTML, CSS, JS, XML. In one archive.

    2. widget cod file. Must be signed.

    3. server-side files. CGI, Java. In one archive.

    Use

    submit 2041 proj files...
 
  Evaluation

The The project will be evaluated based primarily (80%) on meeting the specs — these include system functionality and report contents and on its internal quality — design, style, code, etc. The remaining (20%) is based on how your project compares with those of other teams.

 
  Recommendations

It is recommended that you approach this project in an iterative manner.

  1. Create a remote widget, one that works with the remote database. This widget uses form submission or AJAX to enable the user to add, edit, delete, or search.

  2. Create a local widget, one that works with the device's PIM. This widget has the same interface and functionality as remote, but it uses the PIM API to access the local database.

  3. Merge the two widgets into one. After all, they have the same user interface, and differ only in their database connection. The user can click a radio button on the HTML page to indicate whether the remote or the local database is to be used.

  4. Automate the database selection, by figuring out how to synchronize the two databases.

 
  BB Widget Trial

Test the procedure for developing, testing, and installing an app.

Widget Development

  1. Launch Eclipse with the BlackBerry Web Plugin: click Start, Programs, BlackBerry, EclipseEE BlackBerry.

  2. When prompted to enter the workspace, enter: e.g., Z:\cse2041\workspace

    Do not use the default on C:!

  3. Create a new BlackBerry Widget Project: click File, New.

    If such a project is not listed, click “Other” and type in “BlackBerry” to locate this project type.

  4. Call your project SIS, and type in first.html for the start page.

  5. Double-click first.html so that it opens in the editor window. Delete its default contents by replacing it with the contents of this document:

    www.cse.yorku.ca/course/2041/slides/sisStat/two/sis.html

    You can simply copy and paste from the source of the above document to the editor window.

  6. Right-click the project name and select “New Folder”. If the Folder option is not listed, then choose “Other” and then type “Folder”

    Call the new folder res (for resources).

  7. Right-click the res folder and select “New CSS”.

    Call the new CSS myStyle.css.

    Double-click myStyle.css to open it in the editor window, and replace its contents with the content of this document:

    www.cse.yorku.ca/course/2041/slides/sisStat/two/res/myStyle.css
  8. Right-click the res folder and select “New JavaScript Source File ”.

    Call the new script myScript.js.

    Double-click myScript.js, and replace its contents with the content of this document:

    www.cse.yorku.ca/course/2041/slides/sisStat/two/res/myScript.js
  9. Right-click the res folder, and select “New JavaScript Source File”.

    Call the new script ajax2041.js.

    Double-click ajax2041.js and replace its contents with the content of this document:

    www.cse.yorku.ca/course/2041/slides/sisStat/two/res/ajax2041.js
  10. Save all files and right-click the project name and select “Run As BlackBerry Simulator”.

Testing

  1. Test your app.

  2. You will notice that the simulator refuses to connect to the URL on the server end. Fix this problem by granting permission to the URL's domain and all its sub-domains.

    In addition, fill some of the fields in the config.xml file, so that you can see how they appear on the device.

  3. Test your app again. It should connect properly now.

  4. There is a bug in the app related to gender. Test this by changing the gender and observing the response.

    Fix the gender problem and re-test your app.

App Signing

  1. Visit the URL:

    https://webapp.cse.yorku.ca/bbsign

  2. Upload the cod and csl files in your workspace.

    Navigate to: Z:\cse2041\workspace\SIS\build\StandardInstall
    Z:\cse2041\workspace\SIS\build\OTAInstall\

    to grab the cod file. Use the csl from Z:\cse2041\workspace\SIS\build\StandardInstall

  3. After the widget is signed, download its signed cod file, and save it in the same location. You can over-write the unsigned file, or name it differently.

App Loading

  1. Connect your BB phone to a USB port to charge it.

  2. Make a Web accessible directory under your www/ directory in your home directory. Call it, say, sisApp/.

    Copy the .cod file and the .jad files from build/OTAInstall/ in the directory from your project (under Eclipse) to www/sisApp/.

  3. Set up the BB to use AirYork WIFI. (Authenticate for AirYork.)

    Check the BB can reach the Web by browsing a site or two.

  4. Start the BB's web browser and go to the URL of your www/sisApp/.

    Click on the .jad file.

    The BB will download the app and install! You will find it in BB's download directory.

 
  PIM Widget

Create a new BlackBerry Widget Project in which you can explore accessing local features. Its main HTML page should have buttons that trigger the JavaScript explorations shown here.

Permissions

This widget uses the Widget API to access the “Personal Information Manager”, PIM, onboard the BlackBerry smartphone. As such, make sure you add a feature permission in the widget's config.xml for every backberry.pim.object that you use.

Sample Code

To create an address object:

    var myAddress = new blackberry.pim.Address();
    myAddress.address1 = "2020 CSEB";
    myAddress.address2 = "4700 Keele Street";
    myAddress.city = "Toronto";
    myAddress.country = "Canada";
    myAddress.stateProvince = "Ontario";
    myAddress.zipPostal = "M3J 1P3";
    

To create a contact object:

    var contact = new blackberry.pim.Contact();
    contact.firstName = "Net-Centric";
    contact.lastName = "Computing";
    contact.workAddress = myAddress;
    contact.save();
    

After you run this fragment, go to the built-in “Contacts App” and verify that an entry has been added.

To search and/or iterate over the PIM database:

Use the blackberry.find.FilterExpression object. Note that every entry in PM has a unique uid. The Blackberry Widget API has several examples on using find.