Wednesday, June 10, 2009

How To Create a BlackBerry Launcher


For those of you who want to learn how to make your own BlackBerry launchers can do so. Hit the Jump for more Details...


Required Stuff:

BlackBerry JDE (I use 4.7, which with appropriate simulators should work for older devices as well)
Java JDK
BlackBerry Developer Signing Keys ($20 bucks from BlackBerry, millions of signatures)
Image Editing Software (Paint.Net is my preference)
First you'll need to download the BlackBerry Java Developer Environment. It's basically a fancy java editor that gives you access to the BlackBerry API. In order to download it you'll need to register for a developer account (It prompts before the download so don't worry).


It's under Java Application Development > Tools and Downloads. On the next page click the link for "Learn More about the BlackBerry Java Development Environment". Scroll down and you'll see a link for all of them. I use 4.7 (I think I still have the Beta installed....) but if you were to download other device simulators 4.7 should work for any BlackBerry.


It will prompt you for your username/password once you click to download. Create a developer account and away you go. Download and install the BlackBerry JDE and then move on.

Next you'll need to pick up the Java JDK. This lets you develop in Java and is required by the BlackBerry JDE to work. To pick this up head to the Java Website (http://java.com). Click the link at the bottom for developers. Then click the link for "Java SE Development Kit (JDK)". From there click the link to download the Java SE Development Kit and follow the prompts. Download, install, and move on.


You should be ready to create a launcher now.



Build Your Own BlackBerry Launcher

Open the BB JDE. I can't recall what it looks like the first time, but don't worry about it. Go to File > New. You'll want to create a new workspace. Pick the location and the name of the workspace. I'd recommend creating a folder for the workspace as you're going to end up with lots of files.


Once you have your workspace setup, you'll need to create a new project within the workspace. To do this, right click on the workspace name at the top and say "Create new project in..." I recommend for this that you create a folder for each launcher so the files for each are easily contained. I'm going to create a crackberry.com one just for this example...


Notice that I had to type "crackberry" in both the "Project Name:" and "...Directory:" Boxes. This creates a separate folder for the Crackberry.com launcher and a project for it.

Next you'll need to create a new file in the project crackberry. Go back over to the workspace navigation pane on the left and right-click on the project name and click create new file.


I name my java files the same as my project. This keeps me organized since all the files associated with the launcher have the same filenames. Once you create the file you'll now have a blank Java file.

Now it's time to do the coding portion. The java code is simple and easy. I copy and paste it for each launcher and then change the 2 or 3 sections of code that make them unique.


That's the basic template used for each launcher, all you need to do is change the parts that matter to end up with something like the one below.


You'll notice the part at top in the green are "comments" anything inside the opposing slashes with the ‘*' isn't actually code so it can just be a note for yourself, or someone else if you're giving the files away.

The "package ... ;" needs to be the same as the file name. In this case we have "package crackberry;"

Next you need to put the URL in. This goes in "quotes" and can point to anything.

Now that the coding portion is complete, we need to create a graphic for the button on our device. I use a program called Paint.net, but any image editing software with some basic functionality should work fine.

Create the icon and save the file as a *.png For curve and older devices a 48x48 pixel icon size is probably pretty good. For the Storm, Bold, etc...I use an 80x80 icon size. HOWEVER, you need to be aware that an 80x80 if filled for all those pixels looks huge, so I usually leave a slight buffer. You'll want to create the icons and make sure to save them so they keep transparency. You can also create two icons for a launcher so that when you are highlighting it the icon changes.


Now that you've created your images, copy them to the folder for the launcher. Once the image files are in the folder you'll need to add them to the launcher. Right click on the Java file and click "Add file to..."


You'll end up with something like this:


Now you need to tell the launcher to use the pictures. Right click on each picture file and select "Properties". If you're using two icons you'll need to decide which is the static icon and which is the Focus icon. For this, I'm going to make the cblogo static, and Kevin the focus icon.


Now you need to set the properties for the project. This includes the name, vendor, version and a description of the program.



Once you've got the properties set it's time to build/compile the project. Up at the top of the window you'll notice a menu titled "build". The first option under that is "Build" click that and the program will create something the blackberry can use from the java file.


You'll get two warnings when you build the project. These warnings are because the project hasn't been signed yet and therefore won't work on a physical device yet.


Once the project is built, I suggest you test it out on the device simulator, at least until you figure out what you're doing. This will prevent unnecessary code signatures and a little bit of frustration on your own device.

To run the project up at the top hit the little "{}->" symbol and it will launch the device simulator. The simulator takes a bit of time to boot up. Once the simulator is launched you might need to "load the java program". To do this go the file menu and select it.


Once the Java program is loaded, the launcher will show up in the "Downloads" folder of the device simulator.


You'll notice that on the left is the static icon, and when we click on the launcher it shows the focus icon. If you were to click on the launcher it would launch the simulators browser to the site. If you don't have the network connections configured on your simulator it will open the browser, but won't find the page.

Once you are satisfied with the way the launcher looks in the simulator you can sign it. The signing process is pretty simple once you get your keys from blackberry. The signatures are required to use the Secure API's. The signatures act as a reporting mechanism for RIM to track which applications are using these incase there were to be an issue with a particular application at a later point in time.

To request the signatures head back up to the build menu. At the bottom of the list is a option to request signatures.


Click that and the signature manager opens.


You can see in the Status section of the window that two things are not signed. You'll need to click "Request" down in the bottom to fix that. It will ask you for a password, which is the password that you configured when you installed the signature keys to your computer.

Type in your password and click ok. It will automatically sign the appropriate files and then give you a confirmation. You'll also notice the Status updates to "Signed"



Your launcher is now complete and ready for a real device. To install with desktop manager you'll need to create the ".alx" file. If you are planning to obtain it OTA (from a personal web server) the files are already created and you just need to copy the directory to your web server. Enjoy your launcher! It takes some time and effort to learn how to build your first one, but from there it's easy, fast and free!


BECOME A BLACKBERRY GURU @


BLACKBERRY BASICS






If you like the free service we provide please support our site by visiting our sponsors! We also except Donations.

0 comments:

a
a

Live Traffic Feed

Technology blogs
Add to Technorati Favorites

Back to TOP