Tuesday, 8 November 2011

Phonegap installation guide for blackberry.



to work with phonegap in blackberry , we need to install following things,,,

(1) install Ant
(2) install BB webwoks
(3) download sample phonegap app


##### Install Ant #####

--> download Ant from  http://apache.osuosl.org//ant/binaries/apache-ant-1.8.2-bin.zip
--> Extract and save to in drive C: ,Lets give folder name 'apache-ant' ( without single quotes)

now we neet to set environment path for that...

open Environment variable window

(1) make variable ANT_HOME  and give value    C:\apache-ant\
(2) make another variable JAVA_HOME  and give value   C:\Program Files\Java\jdk1.6.0_11
(3) also add this value in PATH variable  ;%ANT_HOME%\bin


Now open command prompt and type ant ...

if you will get something like this 'Buildfile: build.xml does not exist!  Build failed' ....it works !!


#### Install BB webwoks ####

-->Download Blackberry Webworks from http://us.blackberry.com/developers/browserdev/widgetsdk.jsp

-->install in C: drive lets give folder name BBWP



#### Download sample phonegap app ###

Download it from  https://github.com/phonegap/phonegap-blackberry-webworks

--> now Extract the folder and save in C: drive lets give folder name 'my-phonegap'
-->folder has following contents ,,,,
   -framework
   -javascript
   -template
   -.gitignore
   -bulid.xml
   -LICENSE
   -README.md
   -VERSION


-->go to C:\my-phonegap\phonegap-phonegap-blackberry-webworks-1.0.0-7-g182a043   
and type
   
    ant create -Dproject.path="C:\development\my_new_project"
   
 to create new project ..on succesfull . u will get output something like this

 -----------------------------------------------------------------------------
[code]
 C:\my-phonegap\phonegap-phonegap-blackberry-webworks-1.0.0-7-g182a043>ant create
 -Dproject.path="C:\development\my_new_project"
Buildfile: C:\my-phonegap\phonegap-phonegap-blackberry-webworks-1.0.0-7-g182a043
\build.xml

clean:

build-javascript:
    [mkdir] Created dir: C:\my-phonegap\phonegap-phonegap-blackberry-webworks-1.
0.0-7-g182a043\build\javascript

build-extension:
    [mkdir] Created dir: C:\my-phonegap\phonegap-phonegap-blackberry-webworks-1.
0.0-7-g182a043\build\ext
      [zip] Building zip: C:\my-phonegap\phonegap-phonegap-blackberry-webworks-1
.0.0-7-g182a043\build\ext\phonegap.1.0.0.jar

create:
    [mkdir] Created dir: C:\development\my_new_project
     [copy] Copying 11 files to C:\development\my_new_project
     [copy] Copying 1 file to C:\development\my_new_project\www
     [copy] Copying 1 file to C:\development\my_new_project\www\ext
    [mkdir] Created dir: C:\development\my_new_project\lib\phonegap.1.0.0
     [copy] Copying 2 files to C:\development\my_new_project\lib\phonegap.1.0.0
     [echo]
     [echo] Project Creation Complete!
     [echo] ==========================
     [echo]
     [echo] Getting Started:
     [echo] ----------------
     [echo]
     [echo]   cd C:\development\my_new_project
     [echo]
     [echo]   ant help
     [echo]

BUILD SUCCESSFUL
Total time: 1 second


[/code]
--------------------------------------------------------------------------------------



Now go to C:\development\my_new_project

and edit  project.properties file and set path for BB web works

replace this line

bbwp.dir=C:\\Program Files\\Research In Motion\\BlackBerry WebWorks Packager

with

bbwp.dir=C:\\BBWP


Now it is time to add your html file to www folder ..otherwise it already has default index.html file

[code lang='java']
C:\development\my_new_project>ant build
Buildfile: C:\development\my_new_project\build.xml

generate-cod-name:
     [echo] Generated name: PhoneGapSample.cod

clean:

package-app:
    [mkdir] Created dir: C:\development\my_new_project\build\widget
     [copy] Copying 9 files to C:\development\my_new_project\build\widget
      [zip] Building zip: C:\development\my_new_project\build\PhoneGapSample.zip


build:
     [exec] [INFO]                      Parsing command line options
     [exec] [INFO]                      Parsing bbwp.properties
     [exec] [INFO]                      Validating application archive
     [exec] [INFO]                      Parsing config.xml
     [exec] [WARNING]                   Failed to find the <author> element
     [exec] [INFO]                      Populating application source
     [exec] [INFO]                      Compiling BlackBerry WebWorks applicatio
n
     [exec] [INFO]                      Generating output files
     [exec] [INFO]                      BlackBerry WebWorks application packagin
g complete

BUILD SUCCESSFUL
Total time: 14 seconds



  [/code]
-----------------------

Load into simulator.....


go to C:\development\my_new_project and type  ant load-simulator

final output would be......like this
[code lang='java']



[/code]

##### Load into Device #####

go to  C:\development\my_new_project\build\StandardInstall

using signature tool ...sign the .cod file and using javaloader  load into the device
haapy coding :)
-

No comments:

Post a Comment