How To Create a BlackBerry Launcher

By Kevin Michaluk on 18 Feb 2009 02:15 pm EST
-
loading...
-
loading...
-
loading...
How to Create a BlackBerry Launcher

A few weeks back I made a late night, excited blog post about a new webservice that had just launched, BBLauncher.com. For $3, BBlauncher.com makes it quick and easy for anyone to create their own custom web launcher by uploading images and filling out fields on a web form, from where the finished launcher is automatically generated and emailed to you for your use and distribution.

That post got a lot of comments. Many people saw the convenience of the service, while others said just make it yourself for free! For a while now, CrackBerry member phikai has been taking BlackBerry launcher requests and creating and hosting them for free. So in the spirit of Give a man a fish and you feed him for a day, teach a man to fish and you feed him for a lifetime, phikai has put together an awesome tutorial (after the jump) so those of you want to learn how to make your own BlackBerry launchers can do so. This isn't exactly a newbie tutorial, but I have a feeling a lot of CrackBerry Addicts will be doing some tinkering after they read through the lecture. BIG THANKS to phikai for putting this together. Enjoy your Free launchers everyone!

 


TUTORIAL: HOW TO CREATE A BLACKBERRY LAUNCHER
By Kai Armstrong
CrackBerry Member - phikai
Twitter - @phikai
Website - http://edlindustries.com

Before You Begin...

DISCLAIMER: Kai Armstrong and EDL Industries are in no way responsible for any damage that you may cause to your device(s) or computer. Please only do this if you're somewhat versed in computers and programming. A basic HTML background will make this really easy...especially if you're familiar with templates. None the less don't come harassing me if you screw something major up. *

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).

Launcher

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.

Launcher How To

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.

Launcher How To

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.

Launcher How To 

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...

Launcher How To 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.

Launcher How To 

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.

Launcher How To

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.

Launcher How To

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.

Launcher How To

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..."

Launcher How To 

You'll end up with something like this:

Launcher How To 

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.

Launcher How To

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

Launcher How To 

Launcher How To

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.

Launcher How To 

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.

Launcher How To 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.

Launcher How To

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

Launcher How To 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.

Launcher How To 

Click that and the signature manager opens.

Launcher How To

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"

Launcher How To 

Launcher How To

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!

Reader comments

How To Create a BlackBerry Launcher

43 Comments

Forget that. How 'bout that sweet red & white logo above it there, eh?

America's Team??? Pshhh....HOCKEYTOWN!!!

A real organization.... ...Man's Game!!!

Do you have to have a signature to get it to work on your device? What if all you want to do is install it yourself and not distribute it?

I second the question. I want to make some for my own personal use and not to distribute. Can that be skipped?

Borderpatrol1987

Yes, you have to have signatures. This is to ensure that when accessing the secure API's RIM knows about it. Sorry, but for 20 bucks you can create as many as you want...

I mean i would love to create these but that just seems weird. I would rather just to to the website i am looking for, add it to my bookmarks, clikc the left convience key(set to browser) and choose the link from my book marks.

Awsome tutorial man, really love the detail. But the only thing, is the 20$. IT KILLS ME! haha im cheap lol

Thanks for the tutorial though,
Ben

yeah you only need to buy the keys once. you can then use it for all applications you create.

Firstly great guide and was real easy to follow. I've gone thru and installed the BlackBerry and Java DE stuff, written/copied the code and got to the build step. When i hit build i get this message:

Building pistonheads speed matters
C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\bin\rapc.exe -quiet import="..\..\..\..\..\Program Files\Research In Motion\BlackBerry JDE 4.7.0\lib\net_rim_api.jar" codename="..\Pistonheads speed matters\pistonheads speed matters" "..\Pistonheads speed matters\pistonheads speed matters.rapc" warnkey=0x52424200;0x52525400;0x52435200 "C:\Documents and Settings\ddrinkwater\Desktop\BlackBerry JDE work\Pistonheads speed matters\pistonheads speed matters.java" "C:\Documents and Settings\ddrinkwater\Desktop\BlackBerry JDE work\Pistonheads speed matters\pistonheads static.jpg" "C:\Documents and Settings\ddrinkwater\Desktop\BlackBerry JDE work\Pistonheads speed matters\PistonHeads_Smiley rollover.jpg"
I/O Error: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
Error while building project

It's the error i'm thinking where did i go wrong?? Any help out there?

while the code above is correct you can achieve it a tiny bit simpler (and cleaner) when using Application instead of UiApplication. No need to create an instance, you can call the browser in the static context.
There are also a few lines more that provide a rollover image:
public static void main(String[] args) {
/*
* alternate entry point used by the autostart project
* to provide a rollover icon
*/
if (args.length>0 && "autostartup".equals(args[0])){
HomeScreen.updateIcon(Bitmap.getBitmapResource("icon.png", 0);
HomeScreen.setRolloverIcon(Bitmap
.getBitmapResource("rollovericon.png", 0);
} else {
Browser.getDefaultSession().displayPage("www.website.com";
}
}

if you do not know how to define an alternative entry point take a look at the knowledge base:
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/...

while the code is supposed to work with 4.1 upwards i encountered difficulties when we deployed it on 4.1 OS, it ran fine when i removed the rollover code.

this is a repost from the blackberry support forums:
http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&...

in reply to darren:
you have to set the correct path variables on your system (PATH, JAVAHOME)

Those are the articles I used to learn how to do it...I used the first one, and honestly I've never programmed in JAVA prior to this. I use the code I posted and it works..

Thanks Simon, would you mind explaining to me how i go about setting the correct path variables? I've installed all the stuff and got the code down thanks to you guys already . if you want to ping me off line email is: ddrinkw@googlemail.com
Cheers
Darren

I am getting the following error when trying to build? any one know why?

I/O Error: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
Error while building project

I'm getting the same message as bd22 is. it says...

I/O Error: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
Error while building project

I know for sure my file name is the same so I dont know what I'm doing wrong.

Did you guys go to Control Panel > System > Advanced > Environment Variable. Add the path to wherever your jdk's bin directory is to the Path section. It should then work.

Anyone know how to create the ota? Do I just copy the entire directory to my web server and that's it?

This is my first time doing this so I'm not really familiar with any of this. What is the path exactly? Is it the file name or is it something else. What is the Path Section? When I open up Evironmental Variables there is two sections, either User variables or system variables.

System Variables. Look for a variable called Path. Add the directory wherever your java sdk is installed. For example, click on the path variable, then click the edit button and add C:\Program Files\java sdk\bin\ at the end of the line.

kevin,

assuming that's your storm in the pics, where did you get your detroit red wings launcher? i'd love to get one for the fly-guys.

thanks,

Dan

I'd prefer one for the Chicago Blackhawks...I'm actually trying to create one now but I'm having that message error still

i've google-whored the hell out of fixing the I/O Error: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
Error while building project issue....

got that gone... now i have..

1 error
Error!: Error: java compiler failed: javac -source 1.3 -target 1.3 -g -0 -d C:\DOCUME~\user\LOCALS~1\TEMP\rapc_32d8d233.dir -bootclassp ...
Error while building project

i've made the Path changes in my Environment Variables to locate the jdk\bin file... i've tried different versions of Java SDK... but this is still coming up.. i'm willing to cough up the $20... if i could get this working...

can someone who has this working please post a sample of what your Environment Variables SHOULD look like....

For the errors javac compiler, goes to control painel > system > advanced .. click on the button environment variables..

click on button New, in two variables.. add:

Variable name: PATH
Variable value: C:\Program Files\Java\jdk1.6.0_13\bin

I use the new SDK and JDK 6 update 13, you can to get on the sun microsystem website its free. ^^

after you follow this procedure, reboot your computer and, voi-la.. be happy..
I need to request a signature for my to sign my applications ^^.

I will to disponibilizate very very very applications free to blackberry on the future .. sorry to developers that need money to survive, but I will creating all free ^^

I've got this all working but it won't install OTA. I get this error: "907 Invalid COD HTTP Error 406: Not Acceptable". Any ideas?

I've been reading all over, pretty sure my MIME types are set, but still no luck.

Hi.
when I try to build the project I'm getting thisi error:

I/O Error: CreateProcess: javac -source 1.3 -target 1.1 -g -O -d C:\DOCUME~1\TEMP\LOCALS~1\Temp\rapc_28249802.dir -bootclasspath "..\Program Files\Research In Motion\BlackBerry JDE 4.2.1\lib\net_rim_api.jar" -classpath "..\Program Files\Research In Motion\BlackBerry JDE 4.2.1\lib\net_rim_api.jar" "C:\bb workspace\WebLink.java" error=2
Error while building project

Thanks for your help

Forgive my ignorance, but is there any way to make it point to a third party browser such as bolt? Any help is greatly appreciated!

Hi everyone,

I trying to do the example, I fix it the error on JAVA path.. Thanks!, but when I try to build the proyect, got new one error message:

Building crackberry
C:\BlackberryJDE\bin\rapc.exe -quiet codename=crackberry crackberry.rapc warnkey=0x52424200;0x52525400;0x52435200 import=..\..\..\..\BlackberryJDE\lib\net_rim_api.jar C:\Users\Daniel\Documents\BlackBerry\akipng.png C:\Users\Daniel\Documents\BlackBerry\crackberry.java
C:\Users\Daniel\Documents\BlackBerry\crackberry.java:22: '{' expected
class WebLink() {
^
C:\Users\Daniel\Documents\BlackBerry\crackberry.java:24: expected
site.displayPage("http://www.akimotors.com/m");
^
C:\Users\Daniel\Documents\BlackBerry\crackberry.java:24: illegal start of type
site.displayPage("http://www.akimotors.com/m");
^
C:\Users\Daniel\Documents\BlackBerry\crackberry.java:25: expected
site.showBrowser();
^
C:\Users\Daniel\Documents\BlackBerry\crackberry.java:26: expected
System.exit(0);
^
C:\Users\Daniel\Documents\BlackBerry\crackberry.java:26: illegal start of type
System.exit(0);
^
6 errors
Error!: Error: java compiler failed: javac -source 1.3 -target 1.3 -g -O -d C:\Users\Daniel\AppData\Local\Temp\rapc_11ba4b3e.dir -bootcl ...
Error while building project

Best regards,

Daniel
Margarita Island, Venezuela

Hi,

I am new in BB programming.

I use this code for making a launcher but it showing me an error.

The error is:
JVM error 104 Uncaught NullPointerException

Please help me

Thanks,