Your Development & Design Resource

Blackberry Widget API and SDK - What You Should Know!

I've gotten a few questions about just what the Blackberry Widget API and SDK are... specifically, not only what is it? but also what do I need to know?. Well, less than 24 hours after getting started... I'm happy to report that Blackberry development has never been so easy.

See, before the Blackberry Widget API and SDK, you needed to know a lot of things that most web application developers may only be slightly familiar with. You had to know Java. You had to know WSDL. You should have a firm grasp on WAP. You needed to know how to write web applications for mobile browsers - and when compared to the mobile browser on devices like the iPhone/iPod Touch... well, it was frustrating to say the least.

And then came the Blackberry Widget API and SDK... which sounds really interesting, but most people I know don't get that excited when I talk about Blackberry Application Development. Most people I know are busy working on their own platforms, and the thought of needing to learn yet-another-technology to support what some may consider a nice to have customer base for the majority of their projects.

I know that I've moved "I need this on the Blackberry" to the nice to have column on countless occasions myself - both due to the time it would take to create a local Blackberry client for the project application and (to be honest) my lack of expertise in Java mobile device development and the Blackberry application development platform itself.

See, I'm more of a web application developer. I use HTML, XML, CSS, and JavaScript to interact with web technologies - mostly IBM Lotus Domino - to build feature-rich web applications.

And I'm happy to report that the Blackberry Widget API and SDK is designed for me: a web application developer.

Using any HTML, CSS, JavaScript, and XML editor, you can create a feature-rich web application... that uses the Blackberry Widget API to allow complete interaction with the device.

Want to get information from the Blackberry device like the PIN, IMEI, or interact with the device Calendar?

Just can use these JavaScript functions:

// Display the device model
function displayModel() {
      var model = blackberry.system.model;
      alert("The model of this device is " + model);

// Display the PIN of the device
function displayPin() {
      var pin = blackberry.identity.PIN;
      alert("Your PIN is " + pin);

function displayIMEI() {
      var imei = blackberry.identity.IMEI;
      alert("Your IMEI is " + IMEI);

// Launch the calendar with today's date
function launchCalendar(){
      // Get today's date
      var today = new Date();
      alert("Today is " + today.toString());
      // Launch Calendar App with today's date
      var calendarArgs = new blackberry.invoke.CalendarArguments(today);
      calendarArgs.view = blackberry.invoke.CalendarArguments.VIEW_DAY;
      blackberry.invoke.invoke(blackberry.invoke.APP_CALENDAR, calendarArgs);

And this HTML to call the JavaScript:

            <title>Widget API Basic Sample</title>
            <link rel="stylesheet" type="text/css" href="simple.css"></link>
            <script type="text/javascript" src="actions.js"></script>
                  <p>Widget API Basic Sample</p>
                  <input type="button" value="What is the model of my device?" onclick="displayModel()" />
                  <input type="button" value="What is my PIN?" onclick="displayPin()" />
                  <input type="button" value="What is my IMEI?" onclick="displayIMEI()" />
                  <input type="button" value="What do I have planned today?" onclick="launchCalendar()" />

Yep - it's really that simple! You just write JavaScript functions that interact with the Blackberry Widget API. And you write HTML and CSS to makeup the UI for your application. Yeah, it's pretty simple stuff.

... but you probably think that we're missing something here -- and I am: you need to take your web application - every HTML, CSS, JavaScript, and XML resource - and zip them up into a single file. You then use the Blackberry Widget Packager to create your Blackberry Device Application installation files:

Via command prompt, issue the following commands:

C:\>cd c:\program files\research in motion\blackberry widget packager

C:\Program Files\Research In Motion\BlackBerry Widget Packager>bbwp.exe web/
[INFO]       Parsing option parameters
[INFO]       Parsing
[INFO]       Validating zip archive
[INFO]       Widget packaging starts...
[INFO]       Populating source codes...
[INFO]       Start compiling and building...
[INFO]       Generating output files...
[INFO]       Widget packaging is done.

C:\Program Files\Research In Motion\BlackBerry Widget Packager>

From there, you simply install the now self-contained COD file onto your device the same way you would any other Blackberry Device application, and you're done!

You can install your new applications for testing via the Blackberry Device Emulator or - with a few more steps that I haven't actually gotten to yet - install it on your own Blackberry devices.

The good news? We've got not only API documentation, but some pretty slick examples of how we can better use the Blackberry Widget API to interact with not only local applications and offline data stores, but also interact with web/SaaS/Cloud services.

I'm eager to deep-dive into the integration of a few Lotus Notes Client applications that I've worked on/am working on and the Blackberry Widget API. A good one that comes to mind: a mobile device application for tracking effecient, prioritized time against various customers, projects.

Before that of course, I really need to play around...

About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.

More from is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.