Home arrow Smartphone Development arrow Page 3 - How to Incorporate Location into Your BlackBerry Applications

Display Our Data - Smartphone Development

If you have ever been in an unfamiliar place or stuck in traffic and looking for an alternate route, then you already know the magic that is GPS. One of the hottest areas in smartphone development today is location-based services, and BlackBerry is on the cutting edge when it comes to providing those services. In this article we will discuss BlackBerry’s support of JSR 179, and learn to incorporate GPS functionality into our applications.

  1. How to Incorporate Location into Your BlackBerry Applications
  2. Getting Information via PDE
  3. Display Our Data
  4. Creating the Location Document
By: James Payne
Rating: starstarstarstarstar / 1
August 20, 2009

print this article



Retrieving information is great, but its true power comes in displaying it. After all, what good is data if you can't share it? Fortunately for us, displaying data is fairly simple. The first step is learning XML. Learning XML is necessary because BlackBerry Maps uses location documents to display information on a map. The location document itself is no more than a string that contains some XML elements and their related attributes. Because of this, you will need to know at least a little XML, and understanding the hierarchy of elements will make displaying your data a breeze.

There are three main elements in a location document. They are the <lbs>, <getRoute> and <location> elements. The <lbs> element is used to contain every documentation element in a location document. For this reason, all location documents begin with <lbs> and end with the closed </lbs> element.

Meanwhile, the <getRoute> element holds the route information. If you wish to display any route information on your map, you will need to place two <location> elements between your opening and closing <getRoute> tags. The first of these <location> tags acts as the starting point; the second acts as the ending point.

Location elements hold the information for a location and can contain many attributes. Note however, that if you are placing a <location> element in a <getRoute> element, you can only use the x and y attributes.

The following is a list of attributes that you can associate with the <location> tag:

y - This integer data type holds the latitude in decimal degrees, multiplied by 100,000.

x - Another integer data type that holds the longitude in decimal degrees, multiplied by 100,000.

address - This string data type store the address.

city - This string data type stores the city.

country - Another string data type. This stores the country.

categories - This string data type stores the category.

description - A string data type that allows you to describe a location.

email - A string data type that stores email addresses.

fax - A string that hold fax numbers.

label - A string data type which acts as a label for a point on the map.

phone - A string that stores phone numbers.

postalCode - A string that stores postal codes.

rating - A double data type that allows for rating information, ranging from 0-5.

url - A string that hold URL information.

zoom - An integer that lets you set the zoom level from 0 to MAX_ZOOM.

>>> More Smartphone Development Articles          >>> More By James Payne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Is Facebook Working on a Branded Smartphone?
- Apple iOS 6 Packed With Features
- Finally, Ubuntu OS for Smartphones?
- App Developers Offer Thoughts on Windows Pho...
- App Promo Survey Displays Developer Struggles
- Apptopia Market Helps Developers Recoup Inve...
- Is Fragmentation a Plus for App Developers?
- Juniper Networks: Android App Malware Increa...
- Developer's Losing Interest in Android?
- Android Developers Pushed Towards Google Wal...
- Google Increases Android App Size Limit
- ATandT To Charge App Developers, Android Lac...
- Android Slipping in App War versus Apple
- Apple and Google Battle to Clean Up App Mark...
- iOS Development: Hello World! in Xcode Part 2

Developer Shed Affiliates


Dev Shed Tutorial Topics: