Monday, March 19, 2012

Blackberry Webworks Issues and Pitfalls

Blackberry Issues

è Error: cannot access file C:/windows/TEMP/some =filename.extention, preverifier failed, RAPC error occurred.

The above error occurred on the installation of blackberry ant build. To solve this you have to clear the TEMP folder.

è Blackberry with JQuery mobile: Must remove dot, hyphen and other special characters from the filename also should replace image names without special characters. Because blackberry hate special characters and it never take elements which has special characters.

è Blackberry change simulator

Right click project on eclipse click run as -> run configurations

Double click blackberry simulator click on JRE tab choose alternative JRE from the Installed JRE

Click on Simulator -> General tab choose BB simulator SDK version. Click on apply and close

è Error: If you found any error like “JVM Error uncaught: controlled access exception scroll for available commands” while running blackberry emulator then go to run as -> run configuration and remove all new_configuration and Blackberry webworks under Blackberry webworks

è Issue: Internet not working on emulator or simulator

For solving this issue go to blackberry web works package directory called BBWP or wcpc and click on mds->config folder and then open rimpublic.property file. Then edit after

[HTTP=HANDLER] with following lines

application.handler.http.proxyEnabled = true

application.handler.http.proxyHost=proxy.symphonysv.com

application.handler.http.proxyPort=8080

Note: if you are running under proxy.

Note: wcpc folder will be under

E:\Java\BBeclipse\plugins\net.rim.browser.tools.wcpc_2.0.0.201103231828-18\

Reference links:

http://www.blackberryforums.com/developer-forum/28005-mds-simulator-proxy.html

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/796557/800738/800792/801079/How_To_-_Configure_the_MDS_simulator_to_work_behind_a_proxy.html?nodeid=800740&vernum=4

è Issue: Blackberry simulator keypad is not visible

Solution: disabling graphics acceleration in the simulator (View -> Graphics Acceleration) usually does the trick.

Link: http://supportforums.blackberry.com/t5/Java-Development/simulator-not-showing-the-keypad/td-p/609817

è Error: JVM Error 545

Solution: this is because of dump file. Running clean.bat file will remove all the dump file and will set the default simulator.

Link: http://supportforums.blackberry.com/t5/Java-Development/JVM-error-545-in-8100-emulator/td-p/62869

è JQuery mobile Alpha version 4 does not support Ajax paging

Supported:

jquery.mobile.1.0b2.min.css

jquery.1.6.2.min.js

jquery.mobile.1.0b2.min.js

Unsupported:

jquery.mobile.1.0a4.1.css

jquery.mobile.1.0a4.1.js

jquery.1.5.2.min.js

è Error: The selected server returned an error when attempting to fulfill your request.

Solution: This is because your internet connection is not working or you are under the proxy control. If you are under the proxy control add the proxy setting [refer above] into rimpublic.property file.

è Problem: http sites working fine. https sites returned an error like “The selected server returned an error when attempting to fulfill your request”.

Solution: This is problem with proxy block. Remove proxy and try it will work.

è Getting error like “Error starting sybasecbq: module ‘sybasecbq’ attempts to access a secure API"

This error is happening because the COD file or JAR file is not signed properly.

So, to sign the COD file first get the KEY files from Blackberry.

To get the KEY file use the below link

https://www.blackberry.com/SignedKeys/

To install signing keys follow steps below

http://supportforums.blackberry.com/t5/Testing-and-Deployment/BlackBerry-Applications-and-code-signing-Start-to-Finish/ta-p/445848

è Sign the Blackberry web works application using command prompt

c:\BBWP>bbwp.exe E:\Java\Locate\memorycheck1\build\memorycheck1.zip /g SymphonySV

Here zip file Is that your complete code zip file. SymphonySV is the password of signing keys.

è Application getting too long to respond means the request goes to BB site and goes to serve then comes back to BB site and then user.

è Application getting struck

Solution: Phonegap is creating the stuck issue. This is due to Phonegap.js and jar file. These files are external and too large to use in hybrid application. Taking too much time to load and loaded memory is not been removed while close if application. This memory issue is creating the stuck problem.

è Application icon changing to normal folder and Application give the low memory on multiple open close

Solution: This is also problem with the memory leak issue. If memory leak popup is happening then immediately icon will be changed to normal icon.

- This problem can happen due to handling of callback methods from APIs providing function pointers from Java to JavaScript. By loading below line in directly through JavaScript without using onload function then this problem will happen. To solve this problem clear the menu items and nullify the variable bb_login onclose of application.

Ex: bb_login = new blackberry.ui.menu.MenuItem(false, 0, "Login", call_login);

- If you use phonegap then also the same problem will happen.

This is a known bug in BB6.0 reference

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-Free-Up-Memory-Through-BlackBerry-Webworks-Code/m-p/1499111

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Device-memory-is-Low-issue-for-an-WebWork-app/m-p/1166441/highlight/true#M14223

The fix for these issues are

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/PRE-RELEASE-Memory-Leak-Fix-Download/td-p/1335253

è If we enable ui.HardwareBackKey hardware back button will not close if menu is opened. Instead it will override the back key with your user defined function when you create the build using webworks 2.3 OS. For this use the 2.2 version It will solve the problem.

Use the below URL to solve back key problem.

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/PRE-RELEASE-Memory-Leak-Fix-Download/td-p/1335253

è How to take screenshot of blackberry smartphone

javaloader -u screenshot c:\[name].jpg

http://www.blackberrycool.com/2006/03/10/taking-screenshots-of-your-actual-blackberry/

Blackberry Webworks Build and Load Build to Smartphone Device

Blackberry create Build

è Make a zip file of you blackberry code which has the configuration.xml file.

è Open command prompt

è Go to C:\BBWP

è Enter the following command BBWP E:\Path\to\Your\AppName.zip /g SigningPassword

è Now this will create two folders of bin\StandardInstall\ and bin\OTAInstall

è To load these files to device enter below command

Bin\javaloader –u load E:\Path\to\Your\www\ bin\StandardInstall\AppName.cod

è Now you can access the application in the device.

Some other ways of build creation

Load COD file into the device

1) Start the MDS server from C:\BBWP\mds\run.bat

2) Open command prompt and go to C:\BBWP\bin

3) Now type javaloader –USB load C:\filepath\and\name.cod

è Make Blackberry build using latest Phonegap 1.3:

1) Go to E:\Latest\CBQUAT

2) There will be four mandatory files of

lib,

www,

blackberry.xml,

build.xml,

project.properties

3) Open cmd then cd to to E:\Latest\CBQUAT

4) Run below command to make a build

E:\Latest\CBQUAT>ant blackberry build

5) After build successful

6) Cd to webworks installation directory C:\BBWP>

7) Type below command to sign the build

C:\BBWP>bbwp E:\Latest\CBQUAT\build\CBQUAT.zip /g SymphonySV

8) Now go to E:\Latest\CBQUAT\build\bin\StandardInstall

9) Copy .cod file and paste it to c:\

10) The from cmd cd to C:\BBWP\bin>

11) Type below command

C:\BBWP\bin>javaloader -u load c:\CBQUAT.cod

Log of installed version:

Microsoft Windows [Version 6.1.7600]

Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\msubra02>e:

E:\>cd E:\Latest\CBQUAT

E:\Latest\CBQUAT>ant blackberry build

Buildfile: E:\Latest\CBQUAT\build.xml

blackberry:

build:

generate-cod-name:

[echo] Generated name: CBQUAT.cod

clean:

package-app:

[mkdir] Created dir: E:\Latest\CBQUAT\build\widget

[copy] Copying 41 files to E:\Latest\CBQUAT\build\widget

[zip] Building zip: E:\Latest\CBQUAT\build\CBQUAT.zip

build:

[exec] [INFO] Parsing command line options

[exec] [INFO] Parsing bbwp.properties

[exec] [INFO] Validating application archive

[exec] [INFO] Parsing config.xml

[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: 34 seconds

E:\Latest\CBQUAT>c:

C:\Users\msubra02>cd\

C:\>cd bbwp\bin

C:\BBWP\bin>cd..

C:\BBWP>bbwp E:\Latest\CBQUAT\build\CBQUAT.zip /g SymphonySV

[INFO] Parsing command line options

[INFO] Parsing bbwp.properties

[INFO] Validating application archive

[INFO] Parsing config.xml

[INFO] Populating application source

[INFO] Compiling BlackBerry WebWorks application

[INFO] Starting signing tool

[INFO] Signing complete

[INFO] Generating output files

[INFO] BlackBerry WebWorks application packaging complete

C:\BBWP>cd bin

C:\BBWP\bin>javaloader -u load c:\CBQUAT.cod

RIM Wireless Handheld Java Loader

Copyright 2001-2009 Research In Motion Limited

Connected

Loading CBQUAT Done

1558408 bytes sent at ~623363 bps

Disconnected

C:\BBWP\bin>

How to take screenshot of blackberry smartphone

javaloader -u screenshot c:\[name].jpg

http://www.blackberrycool.com/2006/03/10/taking-screenshots-of-your-actual-blackberry/

Blackberry Webworks Introduction and Development Environments

Introduction:

è Blackberry having two different development environments for Hybrid (HTML5) application called Webworks application and Phonegap application.

è In blackberry, better we should use the Webworks application, instead of Phonegap application.

è Blackberry devices till 6.0 version does not having the enough memory management.

è Due to this blackberry Phonegap application causing the memory leak issue.

è We can achieve the features available in Phonegap through Webworks.

è Using Webworks we can add native functionality to our HTML5 application.

è We can get full access to the platform APIs through JavaScript wrappers.

è Here I listed the problems faced during the Blackberry application development.

Blackberry Installation steps:

WAY 1:

è Download Blackberry Webworks packager (BBWP) from below link

https://bdsc.webapps.blackberry.com/html5/download/sdk

Change the installation path and Install it in the C:\BBWP\

è Get the signing keys from blackberry from the below link. Fill the form and submit. You will receive three signature files. You must have to give your company and company mail id.

è To Install the signature follow the below doc.

START:

The following attachment will allow the BlackBerry SignatureTool to register with the Signing Authority. Please ensure that the BlackBerry development tool of choice has been installed onto the workstation that will be used to sign your BlackBerry applications.

To register the attachment, please follow the instructions below:

If you plan to use both the BlackBerry JDE and BlackBerry JDE Plug-in for Eclipse install the signature keys using the BlackBerry JDE. This should allow you to sign from either tool.

BlackBerry JDE or BlackBerry JDE Component Package Users:

1) Double-click on the attachment.

2) If a dialog box appears that states that a private key cannot be found, complete steps 3 through 6 before you continue. Otherwise, proceed to step 7.

3) Click "Yes" to create a new key pair file.

4) Type a password for your private key of at least 8 characters, and type it again to confirm. This is your private key password, which protects your private key. Please remember this password as you will be prompted for it each time signing is attempted or a signature key is installed.

5) Click "Ok"

6) Move your mouse to generate date for a new private key.

7) In the "Registration PIN" field, type the PIN number that you supplied on the signature key order form.

8) In the Private Key password field, type the password created in step 4.

9) Click "Register".

10) Click "Exit".

11) Repeat this process for the other .csi files.

BlackBerry JDE Plug-in for Eclipse Users:

1) Save all 3 .csi files in the same directory (each one will be sent in a separate email message).

2) Start Eclipse.

3) Click on the Window menu item then Preferences, expand BlackBerry Java Plug-in then select "Install New Keys...".

4) Select one of the 3 .csi files saved in step 1 and click Open.

5) Click "Yes" to create a new key pair file.

6) Type a password for your private key of at least 8 characters, and type it again to confirm. This is your private key password, which protects your private key. Please remember this password as you will be prompted for it each time signing is attempted or a signature key is installed.

7) Move your mouse to generate date for a new private key.

8) In the Registration PIN" field, type the PIN number that you supplied on the signature key order form.

9) In the Private Key password field, type the password created in step 6.

10) Click "Register".

11) Click "Exit".

12) Repeat this process for the other csi files.

BlackBerry Widget SDK, BlackBerry Web Development Plug-in for Eclipse or BlackBerry Plug-in for Microsoft Visual Studio Users:

1) At the command prompt, navigate to the bin folder within the BlackBerry Widget Packager installation directory. Default directories are:

BlackBerry Widget SDK and BlackBerry Plug-in for Microsoft Visual Studio:

C:\Program Files\Research In Motion\BlackBerry Widget Packager\bin BlackBerry Web Development Plug-in for Eclipse:

\plugins\ net.rim.browser.tools.wcpc\ wcpc\bin C:\Program Files\Research In Motion\BlackBerry Widget Packager\bin

2) Type the following command, including the full path of the .csi file:

java -jar SignatureTool.jar <.csi file path>

3) If a dialog that a private key cannot be found appears, perform the following actions:

a. Click Yes.

b. Type a password for the private key.

c. Type the password to confirm it.

d. Click OK.

e. Move the mouse to generate data for the new private key.

4) In the Registration PIN field, type the PIN that RIM. provided.

5) In the Private Key Password field, type a password of at least eight characters. This is the private key password.

6) Click Register.

7) Click Exit.

Important information for all users:

Note: All 3 keys (RBB, RCR, RRT) received need to be installed on the same PC. The same password must be specified for all keys on the same PC. You should receive each key/.csi file in a separate email message.

For further information on BlackBerry Controlled APIs and signing of applications, please refer to the BlackBerry Signature Tool Developer Guide version 4.2.0, found at the following link:

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/8067/645045/8655/8656/1271077/BlackBerry_Signature_Tool_Developer_Guide.pdf?nodeid=1271325&vernum=0

Please note: When registering with the signing authority, ensure that you have correctly entered your registration PIN number. If you enter the incorrect PIN 5 times, your keys will be deactivated.

Troubleshooting:

If you are having difficulty installing or registering your signature keys please check the Signature Key and Code signing section of the Developer Knowledge Base found here: http://supportforums.blackberry.com/t5/Testing-and-Deployment/tkb-p/Testing_and_Deployment_of_Applications%40tkb#/?sort_by=-topicPublishDate&page=1&restrictionStates=no_filter&labels=signature+tool+%2526+code+signing&breadCrumb=%5B%7B%22label%22%253A%22signature+tool+%2526+code+signing%22%252C%22fieldName%22%253A%22labels_signature+tool+%2526+code+signing%22%7D%5D&publishRangeTime=0&attentionState=no_filter&search_type=message

The BlackBerry Development Support Forums can also be a great resource in overcoming hurdles when developing with the BlackBerry platform. Check them out here: http://supportforums.blackberry.com/rim/?category.id=BlackBerryDevelopment

If you continue to experience issues please contact devsupport@rim.com.

Best of luck with your development and thank you for your interest in BlackBerry

END:

WAY 2:

Blackberry Installation steps

Download BlackBerry_JDE_PluginFull_1.3.0.201102031007-19.exe from

http://us.blackberry.com/developers/javaappdev/javaupdate.jsp

Install it

Follow below link. In this link start from Develop a PhoneGap Application Using Eclipse IDE

http://wiki.phonegap.com/w/page/31930982/Getting-Started-with-PhoneGap-BlackBerry-WebWorks

Please note: On installing new software update, it will ask username and password.

Use the blackberry username and password for that.

Username: sunwebsite@gmail.com

Password: Abc123456

WAY 3:

Download blackberry email and MDS services simulator from below link

https://swdownloads.blackberry.com/Downloads/entry.do?code=996009F2374006606F4C0B0FDA878AF1

Install it into windows

Download the simulators you want from the below link

http://us.blackberry.com/developers/resources/simulators.jsp

Install the simulator

To run this application

Start the MDS.exe first

Then, Start simulator in which you want.

Now we have done with the blackberry environment setup