Month: October 2010

Developing Web Applications for BlackBerry Mobiles using Microsoft ASP.NET

Let us see, how to develop a Web application for Blackberry device. Now a days Mobile device plays a  prominent role in our life.

Developing Web applications for mobile devices are made simple with introduction of Microsoft ASP.NET. The main advantage of developing web application using ASP.NET is, it renders the content based on the requested device. Another advantage is, the webpage which is designed to render on Desktop browsers, works perfectly in Mobile browser also.  By just adding some meta tags, web pages display perfectly fine in Mobile browsers.

Microsoft provides two powerful IDE’s for developing Web applications – Visual Studio 2008/ 2010 and Expression Web.

Three major steps in developing Mobile web applications are:

  1. Designing the web page.
  2. Adding necessary meta  tags for display in Mobile devices
  3. Finally, testing the web application using Emulators.

Designing the web page:

Designing of webpage should be done, such that it should be compatible & fit for both Desktop & Mobile browsers. While designing web applications for Mobile devices, avoid web pages with large images, Flash Ads(Some Mobile browsers won’t support Flash. Ex:Apple iPhone etc.,). Web page should be light and very powerful and user friendly. Don’t make it clumsy by adding unnecessary images /text.

NOTE: BlackBerry browser won’t display images more than 1 MB of size. So prefer choosing .PNG images .

Some ASP.NET controls like asp:LinkButton,asp:dropDownList controls won’t work in BlackBerry browsers. To resolve this issue, add the following code under <system.web> section in the web.config file.

<browserCaps>

<filter>

<case match=”(?i)BlackBerry”>EcmaScriptVersion=1.5</case>

</filter>

</browserCaps>

Adding necessary META tags for display in Mobile devices

Two META tags which makes the web page compatible with Blackberry browsers.

<meta name=”HandheldFriendly” content=”true” />

<meta name=”viewport” content=”width=device-width,height=device-height, initial-scale=0.5, maximum-scale=1.0;” />

Finally, testing the web application using Emulators

Now we need to test our web application in BlackBerry browser. RIM provides an excellent tool for testing web application in BlackBerry browser – BlackBerry Plugin 2.5 for VS 2008. Download it and install on your computer.

BlackBerry Plugin 2.5 is bundled with three emulators – BlackBerry Bold 9700, BlackBerry Storm 9550 and BlackBerry Torch 9800.

NOTE: Before installing make sure that JDK 1.6 is installed in your machine, it is prerequisite for installing BlackBerry Plugin 2.5. And also note that the plugin in compatible with Visual Studio 2008 only.

Once the BlackBerry plugin 2.5 is installed, we are ready to test our web application. To test the web application in BlackBerry browser follow the steps below.

  • Launch VS 2008. Open the Website.
  • From the BlackBerry toolbar select the emulator.

emulator_selection

  • In Solutions Explorer, right click on the web page, which needs to be viewed in BlackBerry browser.

rightclick

  • Select Browse with option in the context menu.

select

  • It will invoke Browse with dialog. Now select BlackBerry and click on Browse button.

bb

  • It will launch BlackBerry emulator with the web page.

image

NOTE: You can set the BlackBerry emulator as the default browser to view the Web Pages, by clicking on Set as Default in the  Browse with dialog.