|
CSE-2041A
Net-Centric Computing
York University
Fall 2012
|
Project:
The Great BB PhoneBook App!
|
posted: 20 November 2012
revised: 27 November 2012
|
|
|
|
Welcome to the project.
Your team will develop a mobile app
for the BlackBerry 9000 smartphone
for an “always-on” phonebook app.
due date
|
9:00pm Tuesday 4 December 2012
|
teams
|
a minimum of two, and a maximum of three, students per team
|
platform
|
- client side: BlackBerry widget (WebWorks)
- server-side: CGI and JDBC
- Ripple & Google Chrome
|
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.
|
|
Project Lab #1: Tuesday 20 November
-
Familiarize yourself with the overall project.
-
Pick your team.
-
Build a browser-based (e.g., Firefox)
version of your Phonebook app.
(Lab #4 was the start of this.)
-
Have the HTML of the app stay put.
Use AJAX to update the DOM.
-
Add the functionality that the project asks for.
Of course,
you will not have a local storage
of the contact list as you will in the full app.
-
Use this as a testbed for your design,
both for functionality and for look and feel (UX).
-
Ultimately,
your phonebook app should work
both from your BB app
and from this webapp.
-
Read over the BB Widget Trial.
-
Start working out your design.
I will try getting the BB phones set up for check out
during this lab...but may not make it.
In any case,
there is much to do beforehand.
|
|
Project Lab #2: Tuesday 27 November
Work
on the project in between project lab #1
and this lab
—
project lab #2
—
of course.
Also,
you have another week after this lab
—
project lab #2
—
to finish.
-
Do the BB Widget Trial.
-
Do the PIM Widget exercise.
-
Work out a reasonable solution to synchronizing
the local BB database and the server-side database.
-
Finish your design.
Ideally in the week after this lab
before the project is due,
all you will have left is to polish things
and the Project Report.
|
|
|
|
|
The
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 fall back on the local database when there is no connectivity.
What information should your phonebook entries keep?
As in Lab #4.
|
|
|
|
You
should deliver three things by the due date of this project.
-
working BB app.
The BlackBerry that was assigned to your team,
with the app loaded on it.
-
project report.
Submit the project report.
The report file
—
in pdf format
—
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.
-
overview.
Describes the overall architecture,
design, and implementation issues,
and a self-assessment of any limitation or deficiencies,
-
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,
-
source files.
Listings of all HTML, CSS, JS, Java,
and CGI files that make up the project.
Make sure the code is properly formatted.
-
project files.
Submit your project files.
These include the following.
-
widget source files.
HTML, CSS, JS, XML.
In one archive.
-
widget cod file.
Must be signed.
-
server-side files.
CGI, Java.
In one archive.
Use
submit 2041 proj files...
|
|
|
|
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.
|
|
|
|
It
is recommended that you approach this project
in an iterative manner.
-
Create a browser-based
—
e.g., Firefox on the PC
—
“widget”.
-
Get your database connectivity working.
-
Program in your functionality for your phonebook app.
-
Work out your design and the look and feel of your app.
-
Get things working in the Eclipse emulator.
-
Then get things working on the BB phone.
For the widget,
do things in steps.
-
Create a remote widget,
one that works with the remote database.
This widget uses form submission and AJAX
to enable the user to add, edit, delete, or search.
-
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.
-
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.
-
Automate the database selection,
by figuring out how to synchronize the two databases.
|
|
|
|
Test
the procedure for developing,
testing, and installing an app.
|
|
Get a BB Signing Key
Elect
one person to be the team's “packager”.
He or she should get and authenticate a signing key.
An app must be signed to be loaded onto the BB Bold 9000
(or into the simulator).
Go to
BlackBerry Code Signing Keys
and follow the instructions.
Note: You do not need privileges
for the secure element.
Once you receive the three CSI files from RIM,
use the SignatureTool in the SDK's bin/ ,
as per instructions,
to make a
sigtool.csk
and
sigtool.db .
Make a copy of your
sigtool.csk
and
sigtool.db
somewhere safe and permanent.
(Say in your home directory.)
You will need to copy them into the SDK bin/
of whatever machine you are working on to have that signing key.
Do not only leave them on the Windows machine in the lab;
they will vanish.
Remember (and/or store safely somewhere)
the PIN you used to create the key
and the password you set for it.
|
|
Ripple, Google Chrome, and the Emulator
We
will be using Ripple
to load and package our web-app as a mobile app
for the BB.
Ripple is an extension
for the Google Chrome browser.
-
Start up Google Chrome.
-
Go to URL
Download for HTML5/WebWorks — BlackBerry HTML5/WebWorks.
-
Select the tab BlackBerry OS 7 and earlier.
-
Click Ripple Emulator 0.9.10 beta.
-
Chrome will download it and then
refuse to install it.
-
Accept Chrome's refusal.
-
Open a tab for
Tools > Extensions
-
Find the ripple_ui.crx that was just downloaded
(in your Downloads/ folder)
and drop it on the Extensions tab.
Chrome will then install the extension.
-
In the Extensions tab,
check the boxes for
Enabled ,
Allow access to file URLs ,
and
Developer mode
up top.
-
Ripple needs to be “primed”
before you can work with it.
That is,
it wants you to check-mark that you agree to its license.
-
To do this,
you have to visit a web “app”
at a server over the internet.
-
You can use
www.cse.yorku.ca/~godfrey/app/HelloWorld/index.html
for instance.
-
Accept the licence agreement.
-
Choose WebWorks as the platform.
-
Click the Ripple icon to the right of the URL bar
in Chrome and choose Enable.
-
This should put you into emulator mode!
You should see the “HelloWorld” app
within a phone screen.
-
Choose Blackberry Bold 9700 under Devices.
That is the closest emulator to the actual
Bold 9000's we are using.
You can do a lot with the emulator for working up your project.
|
|
Using Ripple to Build the Package
For
installing a webapp you have built as a
“native” app
on the phone,
it needs to be packaged.
First,
you need your webapp's files
—
the HTML, CSS, and JS files
—
collected together in a folder
(and perhaps, subfolders).
Of course,
you have done this already if you have it live on the web server
under your www/ .
Additionally,
the webapp folder needs a manifest,
an XML file named config.xml .
This tells the phone
—
say, the Bold 9000
—
information it needs to install the app.
Grab
www.cse.yorku.ca/~godfrey/app/sisStat/config.xml
as a template.
Change the information to your own.
You can easily find more on the configuration directives
searching on WebWorks and config.xml.
The packaging process involves archiving the files
along with the config.xml
into an archive (.zip ) file,
processing the archive file to make an
phone “executable” of the app
(one or several .cod files),
and signing the .cod files.
A .jad file is also made
—
in the OTAinstall folder, for over the air
—
which can be downloaded
on the phone's web browser
to trigger the loading of the app
(via .cod files).
One can use Ripple to build
the package.
It takes care of the various steps involved in the archiving
and signing,
so one does not have to do these various steps by hand.
Ripple will only build something
from the local file system.
It will not build from a URL to a server somewhere else!
For this,
Start Services under Ripple 's
Build tab.
Now Chrome is running a miniature, local web server for you
on port 1190!
The root of the web directory for this server
is RippleSites/
under your home directory on that Windows machine.
E.g., C:\Documents & Settings\csexxxxx\RippleSites\ .
So, make such a directory.
For each folder of each webapp you are working on
—
e.g., sisStat
—
you will need to copy that folder locally
under your
RippleSites/ folder
for Ripple to be able to package it.
Then, you can access it at the URL
http://localhost/sisStat/index.html
(assuming your main HTML
“root” page is index.html ).
You will also need a folder to tell
Ripple
where to put the package.
For myself,
I made a folder called
RipplePackages/
next to my
RippleSites/ folder
for this purpose.
In Ripple ,
open Settings under Build
to fill these values in.
- SDK Path
- Project Root
- Archive Name
- Output Folder
- Password
The SDK Path is for the Webworks SDK.
Find what it is by looking under
C:\Program Files\Research in Motion\
for it.
The archive name is the same as the name
of the app as stated in the config.xml .
The password is the one for your signing key.
After you have Settings set up,
clicking Package & Sign
will make you a signed package!
To upload the app onto the phone via the package,
you will need to move the OTAinstall folder
from it to under, say, your PRISM home director's www/
so that the www.cse.yorku.ca HTTPD server
can serve it over the air.
Point your BB Bold 9000's web browser at it,
select the .jad ,
and the app will load.
|
|
The Blackberry Bold Simulator
Alternatively,
one can choose
Package & Launch
from Ripple 's Build.
Assuming you have selected 9000-5.0.0.xxx
for Simulator under Settings,
Ripple will package and sign the app
and send it to a software simulator
of the BB Bold 9000 phone.
The simulator actually simulates the workings of the phone device on
the computer.
It is rather slow,
but presents a rather accurate picture
of how the app will behave on the actual device.
(This is different than the light-weight emulators
within Ripple .
These give you a view of what your app would likely look like
on the device,
do let you do some testing and debugging,
but are not simulating how your app would actually run
on the device.)
This is an alternate way of testing your app
wihtout always needing to upload it to the physical phone
each time.
|
|
The BB Bold 9000 Phones
You
can check out your phone
from the Lab Monitor at the desk in #1006.
You should not leave the building with it!
Use the phone unit # assigned to your team!
That is where your app(s) will be,
and what I grade for you team in the end.
If you swap around phones,
chaos ensues!
teams
|
|
SIS Stat Exercise
Steal
the sisStat
webapp from
www.cse.yorku.ca/~godfrey/app/sisStat/.
Play with it in the Ripple emulator.
Rewrite the config.xml to have your information.
Build and launch it in the BB Bold simulator and play with it there.
Build and sign it
and load it onto your actual BB Bold.
|
|
|
|
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 following.
|
|
|
|
This
section is for frequently asked questions
and will be updated as needed to provide
extra information,
help,
and
clarifications.
|
|
CGI Headers
When
I try accessing my CGI via AJAX from an HTML page
I have loaded in the browser by file:// ,
it always fails, returning a status of 0, not 200.
But it works accessing the HTML page from a server
by http:// .
What is the problem?
This
is due to security features in Web standards
called cross-domain blocking.
Your HTML page appears to come from another domain
than the CGI does.
The CGI can override this,
by adding the following headers in its response.
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
|
|
|
|
|