Phonegap Framework setup for Blackberry Application Development
Application
Development and
Deployment
Document
For
Blackberry
Application With
PhoneGap
Framework
1.1
PhoneGap
in a Nutshell
PhoneGap
is an open source development framework for building cross-platform mobile
apps. Build apps in HTML and JavaScript and still take advantage of core
features in iPhone/iPod touch, iPad, Google Android, Palm, Symbian and
Blackberry SDKs.
Write
once, run anywhere' platform for mobile application development, with the first
three devices supported being the iPhone, Android and BlackBerry. Rob Ellis,
one of the co-creators of PhoneGap said, 'The idea is you write one code base
and it should work smoothly on all three devices
Table 2 – Terminology
2.2 Software
o
Sun Java Development Kit,
version 1.6 (32-bit)
o
ANT
o
Eclipse 3.5+, the Classic
Eclipse package is fine
o
BlackBerry Java Plug-in for
Eclipse
3 Environment Setup And Development
Regardless of
your development preference, you must install both ANT and Eclipse.
3.1
Installing
Apache Ant
- Download ANT
- Extract to a desired installation directory, e.g. C:\apache-ant
- Set ANT_HOME
o
Open System Properties
-> Advanced -> Environment Variables
o
Create a new system variable
- Variable name: ANT_HOME
- Variable value: C:\apache-ant
- Add ANT_HOME to PATH
o
Open System Properties
-> Advanced -> Environment Variables
o
Under system variables, edit
PATH
- Add
;%ANT_HOME%\bin
to the end of the PATH value. - e.g. %SystemRoot%\system32;%SystemRoot%;%JAVA_HOME%\bin;%ANT_HOME%\bin
- Verify that ANT is installed
o
Open your command-line tool
(cmd.exe or cygwin.exe)
1.
$ ant -v
2.
Apache Ant version 1.8.1 compiled on April 30 2010
3.
Trying the default build file: build.xml
4.
Buildfile: build.xml does not exist!
5.
Build failed
3.2
Setting Environment for Phonegap-Blackberry
- Download following things first
o
phonegap-phonegap-blackberry-0.9.2-0ga0e22ea.zip
o
bb-ant-tools-1.2.9-bin.zip
o
ant-contrib-1.0b3-bin.zip
- “Phonegap-phonegap-blackberry-0.9.2-0ga0e22ea.zip”
In this package,
you will get a “framework” folder in which framework for blackberry is present.
- In this folder, you will get the “build.xml” file.
Open this file and make following changes.
o
<taskdef
resource="bb-ant-defs.xml"/>
Replace this with
<taskdef resource="bb-ant-defs.xml">
<classpath>
<pathelement
location="path till bb-ant-tools.jar" />
</classpath>
</taskdef>
o
For e.g.
<taskdef
resource="bb-ant-defs.xml">
<classpath>
<pathelement location= “D:\Cross
platforms\PhoneGap\bb-ant-tools-1.2.9-bin\bb-ant-tools.jar” />
</classpath>
</taskdef>
o
<taskdef
resource="net/sf/antcontrib/antcontrib.properties"/>
Replace this with
<taskdef
resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement
location="path till ant-contrib.jar"/>
</classpath>
</taskdef>
o
For e.g.
<taskdef
resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement
location=" D:\Cross platforms\PhoneGap\ant-contrib-1.0b3-bin\ant-contrib\ant-contrib-1.0b3.jar
"/>
</classpath>
</taskdef>
- Now go to “framework” folder and edit “common. Properties” file.
o
Edit the 2nd
variable “jde.home”.
o
Set the path to jde 4.6.1 or
higher.
o
For e.g.
jde.home = C:\\Program Files\\Research In
Motion\\BlackBerry JDE 4.6.1
(Double slash is necessary)
3.3
Application
Execution
1.
Now your framework is ready.
o
Go to command prompt.
o
Change the directory to -->
location where your “phonegap-phonegap-blackberry-0.9.2-0ga0e22ea”
folder is
o
Command prompt should look like this --->
D:\Cross
platforms\PhoneGap\phonegap-phonegap-blackberry-0.9.2-0-ga0e22ea>
2.
Run following commands
o
cmd> ant
o
cmd> ant create
–Dapp.name=”NAME OF APPLICATION”
–Doutput.dir=”LOCATION
WHERE YOU WANT OUTPUT”
–Dpackage=”NAME
OF THE PACKAGE”
o
E.g. ant create
–Dapp.name=”MyApp” –Doutput.dir=”C:\MyApp”
–Dpackage=”com.kpit.phonegap”
3.
The project named
“MyApp” will be created into folder “C:\MyApp”.
4.
Now go to the path specified in
“–Doutput.dir”, Here “C:\MyApp”
o
You will again see a
“build.xml” edit that file as in step 3.
o
Don’t follow the step 3.
o
Only edit the “bb-ant-defs.xml”.
5.
Your project has been
configured.
o
Now go to command prompt again.
6.
Go to the path specified in “–Doutput.dir”
o
(Where you have just created
the current project)
7.
Run command
o
>>ant load-simulator
4 Cross Platform Frameworks
4.1
PhoneGap:
4.1.1
Advantages
o
Application are written using HTML, CSS, and Javascript, which
is then wrapped into native app code and displayed using PhoneGap platform
libraries using the device-specific browser object.
o
Free (entire framework is
open-source)
o
Ability to deploy a single
codebase on multiple platforms
o
Provide JavaScript APIs to
access the native features of the devices such Camera, GPS/Geolocation,
Vibration, Accelerometer and Sound.
o
Integrates with native source
code (app-based web browser object)
o
Overall built using everyday
web languages, takes advantage of all possible native UI objects, extremely cross-platform
and it allows device hardware access.
o
Supports iPhone/iTouch, iPad,
Google Android, Palm, Symbian and Blackberry SDKs.
4.1.2
1.1.2
Weakness
o
Application is rendered using
platform’s web browser engine, not individual native UI objects.
o
No supports for Blackberry OS
4.2, even in Blackberry OS 4.6 very basic API’s are available, supports only
for Blackberry OS 5.0.
o
Programming in HTML, CSS and
JavaScript, so can not create applications with rich graphics content.
o
Not feasible for creating
Enterprise Applications.
.
4.2
Titanium:
4.2.1
Advantages
o
Titanium primarily uses
Javascript and JSON code to as the application language, though it can make use
of Ruby, Python, and PHP scripts.
o
Free (entire framework is
open-source)
o
Ability to deploy a single
codebase on multiple platforms.
o
Provide JavaScript APIs to
access the native features of the devices such Camera, GPS/Geolocation,
Vibration, Accelerometer and Sound.
o
Generates real native source
code as part of the build process, accessible to developer
o
Compiles to truly native
application code, not HTML5.
o
Supports Ruby, Python, and PHP
scripts for broad developer coverage.
4.2.2
Weaknesses
o
Titanium currently supports
Android and the iOS (iPhone/iPad) platform only.
4.3
Rhodes:
4.3.1
Advantages:
o
Rhodes is a complete
Model-View-Controller framework written in Ruby.
o
Free (entire framework is
open-source)
o
Ability to deploy a single
codebase on multiple platforms.
o
Interfaces with device hardware
such as camera, GPS, and accelerometer using Javascript.
o
Rhodes takes your Ruby code and
compiles it into native code for whatever device(s) you wish to target.
o
Browser-based app construction
using RhoHub.
o
Easy multi-device and cloud
data syncing using RhoSync.
o
Builds native apps for all
major Smartphone operating systems (iPhone, Windows Mobile, RIM, Symbian and
Android.
4.3.2
Weaknesses:
o
Does not output native source
code, only native package.
o
Runs entire app through bundled
Ruby VM interpreter.
Great post . It takes me almost half an hour to read the whole post. Definitely this one of the informative and useful post to me. Thanks for the share. I also provide this service plz visit my site phonegap application development in west delhi Elesoftech is a leading offshare web development.
ReplyDelete