Creating A WebIcon; :: BlackBerry Application Development Tutorial; (Part-4)

Posted on Updated on

Hello All;
Hope enjoying the world around you;

Surprised;?? I know; After a long time im here writing a tutorial on blackberry development; It is a requested tutorial, asked by some developers few days back; So here it is;

Note: This tutorial is a part of serieis of my tutorials on blackberry application development; So far we have discussed the followings.

Introduction:
My friend has a problem; He visits a site many times a day; Every time he has to open browser, type the site name or chose from favorites to see it; He asked what if there is an icon on my home screen that directly open a browser and navigate to that particular site; By doing this, i need just one tap, just one;

Solution is Web Icon; How?  I”m telling you next. First bring a cup of coffee or tea whatever you like; I brought a cup of Qehwa (a local drink for winters) with two chocolates; Bryan adams is playing in background; Sit relax;

Here we go; A web icon is an application that launches a BlackBerry smartphone browser to a predefined web address; Web icons aredisplayed in the list of BlackBerry smartphone applications and they can be used as shortcuts to a BlackBerry smartphone user’s favorite web sites;

Lets start; The first thing is to create a new class that extends from WebIcon; Here I’m dividing talk in two parts; Frist for the devices earlier to 4.0 and second part is for 4.1 and laters;

1. BlackBerry Device Software earlier than 4.0

When using BlackBerry Device Software versions earlier than 4.0, the default browser is the only one that can be invoked;

As an example, a new class called BlackBerryWebIcon is created below that extends WebIcon and points to my blog, aasims.wordpress.com; Only three lines of code need to be added to the main method of this new class.

2. BlackBerry Device Software 4.0 and later

The previous sample can also be used for BlackBerry Device Software up to and including 4.2.1, although the following code samples offer a simpler methodology for allowing the web icon to invoke the default browser or invoke specific browsers on the BlackBerry smartphone;

A web icon may invoke either the default browser on the BlackBerry smartphone, or the Internet Browser, the Wireless Application Protocol (WAP) Browser, the BlackBerry® Browser, the Wi-Fi® Browser, or the BlackBerry® Unite!™ Browser.

The following code creates a web icon that launches a browser to a specific web address for the given browser type;  If the given browser type is not available, the web icon launches the default browser;

Note: The previous code sample makes static calls to a factory class called BrowserSessionFactory to create these different BrowserSessions; One thing more ist that BlackBerry Device Software 4.2 may prevent the previous code sample from opening the default browser; As a workaround, add the following code after the call to the displayPage method; This issue was resolved in BlackBerry Device Software 4.2.1;

As an example, a new class called BlackBerryWebIcon is created in the following sample that extendsWebIcon and points to my blog, aasims.wordpress.com;. Again, only three lines of code need to be added to this new class.

At this point we are get done with code; Thumbs up; Plus its time to change Bryan adams; Let try some slow number of  richard marx;

Orite, next is to set the title of your application, as this title will be appears on the Home screen of the smartphone  user scrolls over the icon; To to this, right-click the project, select Properties and then select the General tab; In this area, you can type the application title, vendor name and application description;

Done; ?? great; Now next is to add an application icon; This is the icon that displays on the Home screen of the BlackBerry smartphone; Do  the following steps:

  • Create an image, approximately 32 x 32 pixels in size.
  • Right-click the project, select Add File to Project, and then navigate to the custom icon.
  • Once the file is added, right-click the file, and then select Properties.
  • Select the check box for Use as Application Icon.

Congratulation; You have done; Isn’t that simple; ?? Indeed it is; Make victory sign; Compile and deploy on your phone;

Feel free to throw queries incase you found a problem;
Have a nice time;

Happy Development;

source: http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800440/How_To_-_Create_a_web_icon.html?nodeid=1487655&vernum=0

free counters

Advertisements

20 thoughts on “Creating A WebIcon; :: BlackBerry Application Development Tutorial; (Part-4)

    […] Creating A WebIcon :: BlackBerry Application Development Tutorial (Part-4) […]

    […] Creating A WebIcon :: BlackBerry Application Development Tutorial (Part-4) […]

    ahmad Saleem said:
    February 23, 2011 at 02:45

    blackberry??? again?? you told you were in iPhone.

      y. Akbar said:
      February 23, 2011 at 02:51

      ye Mr Ans hain ye kch b ker sakty hain kisi b time. Aj ye iPhone my hy kal ye android my ho ga person kisi or chez my. He will get mad one day. itni c jaan hy is ki.

    […] Creating A WebIcon :: BlackBerry Application Development Tutorial (Part-4) […]

    Maqbool said:
    February 23, 2011 at 08:15

    kindle, android, iphone, blackberry. what next. i think windows 7 phone. 🙂 🙂
    thumbs up for you dude.

    Amna Zaree said:
    February 23, 2011 at 10:43

    Ans bahi you great. Everytime you bring a detail words about something interesting. good work. im working in C# now a days. need little help.
    well you are guro no doubt. dnt know how you move take different things parallel.

    Khalid Abbasi said:
    February 23, 2011 at 11:13

    Well done Ans. very descriptive way to telling whole story. Your style of explaining things is impressive.

    Aqueel Ahmad Mirza said:
    February 23, 2011 at 14:27

    Yar kafi tareef ho gae hai teri. Itni bohat hai :-p
    well done buddy. Keep it up bro 🙂

    fusion said:
    February 25, 2011 at 17:31

    very nice information you are sharing i really like that keep it up thanks.

    bobby said:
    May 2, 2011 at 14:29

    Really guys, Nice Article and its very important for me because I am a new in Mobile Application Development and your others blog Posts really help me, Pls share another article on a new Tech of Blackberry Playbook Development. Thanks a lot…

    Sara said:
    July 3, 2011 at 13:50

    Do you have url for book or tutorial for full blackberry development?

    waisome said:
    July 13, 2011 at 21:27

    i would like to create server vs client application with the basic start to access to a file or folder on a set location and then byextentions a form of remote desktop application concepts can u advise were to get started

    sri said:
    August 30, 2011 at 19:38

    I Dint Understand this program….part3 was so simple and part4 was v difficult…many builtin functions which require a prior knowledge am i ri8?

    Scott said:
    September 12, 2011 at 22:58

    Does anyone know a way we could do this but instead of opening up a web URL have the icon open up a static HTML file that is packaged with the application? WOuld love to do this for an emergency contact list I have created. As the list changes I could just re-push the app a couple times per year.

    Mark C said:
    November 15, 2011 at 06:59

    i am experiencing “BrowserSessionFactory cannot be resolved” . Do you have the code for this class as it pertains to this tutorial?
    Thank you,
    M

    agus @ ROR Developer said:
    December 22, 2011 at 12:33

    I have a few good app ideas but don’t have the necessary skills to make it happen. Is there any advice that you could give me on how to get my app up and running?
    Thanks

      Ans responded:
      December 22, 2011 at 16:36

      one option is you hire or outsource someone and pay one once to develop your application; Once it ready you can push it to blackberry store and can earn money when people download it or use in-App purchases;

    recessionbearddc said:
    December 30, 2011 at 21:33

    Hi Aasim,
    How do I remove a system menu item? lol, finally got the programs signed and running on my phone. There were some other tutorials that I also followed. Here is the link to the tutorials:

    http://www.blackberrycool.com/2009/07/16/how-to-write-a-blackberry-application-lesson-3-create-shortcuts-and-more/

    My question is: How do I remove a system-wide menu Item? I’m going to keep digging but figured if you knew maybe you could help me.
    Have a great New Years!
    RB

    David said:
    May 5, 2012 at 17:41

    Quiero ese programa para llamar grati

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s