Archive for the ‘Development’ Category

BlackBerry Application OTA Download Setup

While working on my latest project, BlackPing, I ran into another snag - I couldn’t get my application to download Over-The-Air (OTA).  The problem was due to my lack of understanding, hopefully my trouble is your gain.  Below you’ll find instructions that guide you through preparing your application for OTA downloads.

Setup the HTTP Servers MIME Types

If you do not have administrator access to your web server then you’ll need help from the administrator to perform the following.

Verify that there are MIME Types setup for COD and JAD files.  The correct MIME Types are respectively “application/vnd.rim.cod” and “text/vnd.sun.j2me.app-descriptor”

Upload the Application to the Server

You’ll need to upload the application’s COD, JAD and JAR files to the web server.

Create an HTML “Download” Page

This is the part that I spent a while figuring out.  During my first attempts at OTA installation I opened the BB Browser and went directly to the application’s JAD file.  Each time I did this the browser displayed the contents of the file instead of trying to download and install it.

To get around this issue, create a “download” page.  I recommend a simple page that way you don’t have to worry about the page renders on varios BlackBerry devices.  This page should reside in the same place as the application files, but you can place it whereever you want, you’ll just have to do more configuration.

My simple download page:

<html>
<head>
<Title>Download [APPLICATION_NAME]</Title>
</head>
<body>
<a href=”[APPLICATION_NAME].jad”>Download</a>
</body>
<html>


I hope this post saves you some trouble.  If it does, or if you have questions, please leave a comment.

Sunday, March 1st, 2009

BlackBerry Code Signing Help, Part II

In a previous post (BlackBerry Code Signing Help), I ran into problems signing my API Keys (.CSI files).  Also in that post, I had trouble Requesting Signatures for my application.  Both problems are now resolved and I was able to successy install my latest project onto my BlackBerry Storm.  (My tweet-of-joy)

Instead of simply making this a “yippee” post, I’m going to provide details on how to sign your API keys and then how to request signatures for your application.  I realize that BlackBerry provides instructions but they don’t seem too clear, at least they don’t to me.

Request Java Code Signing Keys

RIM requires that a developer register with them before he is allowed to access certain “sensitive” APIs.  These APIs fall under three categories: Runtime APIs, BlackBerry Application APIs, and BlackBerry Cryptography APIs.

Registration is $20 and you can register online using the “BlackBerry Code Signing Keys Order Form.”  For more details as to why RIM requires registration and for what specific APIs are controlled, visit the “Java Code Signing Keys” page.

Registering Your Keys with The Signing Authority

Once you have registered for your code signing keys, RIM will send you three files: a “client-RCR-#####.cod,” “client-RRT-#####.cod,” and a “client-RBB-#####.cod.” Each file will be sent in a different email.  You can then follow the instructions in the “BlackBerry Signature Tool Developer Guide” (a PDF download).

This is where I ran into my first problem - when I double-clicked a .COD file, Windows did not know which application to open the file with.  Please refer to my “BlackBerry Code Signing Help” article for instructions on how to resolve this issue.

Once you have successfully registered your keys with the signing authority two files will be generated - a “sigtool.db” and a “sigtool.csk.”  These files will be placed in the same location as the “SignatureTool.jar” file.

If you have the BlackBerry JDE Plug-In for Eclipse and the BlackBerry JDE installed be very careful as the “sigtool.XXX” files may have been placed where you don’t expect! In my case, they were placed in the directory of the stand-alone JDE therefore the Eclipse plug-in couldn’t find them.

Signing Your Application Using the BlackBerry JDE Plug-In for Eclipse

To sign your application first make build it by going to Project >> Build Active BlackBerry Configuration.  Next, go to BlackBerry >> Request Signatures this will bring up the “Signature Tool” window.

The Signature Tool window will contain multiple rows of data but you really care about the rows with a “Status” of “Not Registered” and a “Category” of “Required.”  If the text in the “Status” field is red it means that the key mentioned in the “SignerID” column is missing or that the key hasn’t been registered.  If the text in the “Status” field is navy blue it means that the key mentioned in the “SignerID” column exists and has been registered but the application has been signed with that key.

To sign your application (represented by a .COD file) click the “Request” button at the bottom of the “Signature Tool” window.  You will then be prompted for your Private Key.  Note that the Private Key is different from the Registration PIN you supplied to RIM.

Once your application is signed the “Status” fields will read “Signed” and they will be green in color.  You are now ready to deploy your application to a real BlackBerry.

Remember that each time you build your application a new COD file is generated and it will need to be signed again before the application can be deployed to a BlackBerry device.


I hope this article provides you some guidance as you get started in developing BlackBerry applications.  If you have any comments please feel free to email me or post a comment.

Saturday, February 28th, 2009

BlackBerry Code Signing Help

I ran into a little trouble with BlackBerry’s code signing scheme.  The root problem was that Windows didn’t know what program to use when opening a .CSI file.  I feel this is a problem with the BlackBerry JDE Plug-In for Eclipse installation, but I still needed a resolution.  The tech support team at RIM referred me to a knowledge base article which pointed me in the right direction.  Since I had a compatible Sun JDK installed, and I didn’t want to re-install RIM’s tools again, I opted for the command line method.  Since you have to sign three different keys, I created a batch file to make things easier.

The batch file I created is below.  Please look at the simple code since you may have to change some of the paths to make them appropriate for your system.  Once you create the file, place it in the same directories as your .CSI files and then you’ll be able to simply drag-and-drop the .CSI file “into” the batch file.  You’ll then be prompted for all the information RIM needs to register your keys.

javaw -jar “C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\bin\signaturetool.jar” %1
pause

Now that your CSI files are signed, you need to register your application.  In Eclipse, you go to Eclipse >> Request Signatures.  Then you select each record in the table with a status of “Not Registered” and click the “Request” button.  This is where I, again, run into trouble.  Check back later, hopefully tomorrow, when I write up instructions on registering your application.

Monday, February 23rd, 2009

First Experience with the Blackberry JDE for Eclipse and Some Tips

I’ve embarked on a new project that involves writing software for the Blackberry.  So far it has been a maze of encryption keys, development environments, simulators and lots of mis-steps.  In the coming months I plan on writing a few posts on my experiences but, for now, I plan on focusing on one of the things that has been causing me the most pain - The Blackberry JDE (Java Development Environment) plug-in for Eclipse.

In the past I’ve used Eclipse extensively.  While at Lodgenet, it was my main IDE.  So I’ve gotten familiar with the environment and it’s plug-in potential.  Although I consider myself experienced, I’m definitely not an expert when it comes to Eclipse which could be the main source of my agony.

Overall the JDE plug-in is very nice.  It allows you to seamlessy develop and test your Blackberry application against a wide variety of simulators.  (If you’ve ever checked out the original Java Development Environment from RIM, you realize how much nicer Eclipse is.)  The problem I ran into is this - I had all of the JDE Component Packages installed yet I couldn’t see the simulator for the Blackberry Storm.  After some back-and-forth with RIM’s Technical Support proved to be worthless, I returned to a lot of digging on Google.  Thankfully I came across this thread in their support forums.  It had the answer I was looking for:

You can then select the comoponent pack to use  from Window->Preferences->BlackBerry JDE->Installed Components.  This will let you use the simulators available for the component pack you choose.

That one simple paragraph saved the day.  I can now test applications for my Storm, and my friends’ Blackberries (Friends, if you’re reading this you’ll be getting an email soon asking you to help me alpha/beta test this software.)

To help other people who are as dense as I am, or those who just want to see what I’m talking about in action, below are some instructions and screen shots that show the problem I had.  I will also show you how to configure Eclipse to make your development go a little more smoothly.

Choosing Your Component Package

This is where I went wrong - I didn’t know this could be done!  Simply go to Window >> Preferences and you’ll see a dialog like the one below.  In the “Choose one of Installed Components” menu, you’ll see all of the JDE Component Packages that you have installed.  Each component package is used for testing a different version of the RIM’s Java API and for running different phone simulators.  You must do some research on which component package is appropriate for your situation, see RIM’s KB article:  What Is - Appropriate version of the Blackberry JDE.

Note - I think it’s safe to assume that if the Component Package you select doesn’t include all of the devices you’d like to support, you’ll need to create a separate release.  There may be a work-around or “Compatibility Setting” to make things easier, but I haven’t found (nor have I really researched) one.

Eclipse Preferences Dialog

Creating a Run Configuration

If you’re familiar with Eclipse, Run Configurations are nothing new.  But, I include some instructions here just for completeness.

To create a new Run Configuration, go to Run >> Run Configurations and you’ll be presented with the dialog below.  Using the tree on the left of the dialog, select “Blackberry Simulator” then click the “New Launch Configuration” button.  Give the configuration a meaningful name (Example: “BB Pearl 8130″) and select the “Simulator” tab.  On this tab you’ll see a “Profile” menu.  In that menu are all of the devices that are supported by the Component Package you selected previously.  To make this configuration match the name above select “8130-JDE.”  Now, click the “Apply” button and that will save your configuration.

I recommend that you create a Run Configuration for each device you want to test.  Alternatively, you can create a configuration for each Component Package you have installed.

Eclipse Run Configuration

Using Run Configurations

Using the configurations you create is simple - Open the Run Configurations dialog, select the appropriate configuration and then click the “Run” button.  Once you use a configuration once, it will be added to the list of configurations under the “Run” button (the one that is located on the main IDE screen). One thing to remember is that you’ll get odd errors if you use a run configuration that includes a device that isn’t supported by the Component Package that you’ve selected.  Therefore, be sure to keep in your mind which device you’re using and which Component Package you have selected.

Sunday, February 22nd, 2009