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

Creating the Location Document - 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.

TABLE OF CONTENTS:
  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
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Now that we know the XML elements and attributes that make up a location document, we can create one. There are two types of location document that we can create. The first is one that uses only required elements:

"<lbs>

<location y= 'latitude' x ='longitude' label ='MyLabel' description='This is my description' />

<location y= 'latitude' x ='longitude' label ='MyLabel' description='This is my description' />

<location y= 'latitude' x ='longitude' label ='MyLabel' description='This is my description' />

</lbs>"

The second type of location document is one that uses both required and optional elements:

"<lbs>

<location y= 'latitude' x ='longitude' label ='MyLabel' description='This is my description' zoom='MAX_ZOOM' address='address' rating='3' />

<lbs>"

Displaying the Data

The last step in the process is to actually display the data on a map. To do so, create a new string and feed it the location information for your location:

String document = "<location-document><location x=' -3942102' y='1234567' label ='New Mexico, USA' description='New Mexico' zoom='5' />

</location-document>";

Next, you will need to Invoke the following:

Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(MapsArguments.ARG_LOCATION_DOCUMENT, Document));

It's that simple.

While it is beyond the scope of this article, it should also be noted that geoencoding and route generation are both supported.

One other important thing to note is a feature that makes the BlackBerry stand out from the crowd - namely, ephemeris information. In Standalone mode, the user's device must scan the entire sky to find satellites. With ephemeris information, BlackBerry devices are updated every 3-4 days with the approximate location of the satellites, resulting in a much faster first fix in Standalone mode.

Conclusion

We have literally only touched the tip of the iceberg when it comes to incorporating location into your BlackBerry apps, but I think this is a good starting point. We'll continue looking at how to display location, and other location retrieval techniques, in an upcoming article, so be sure to drop by often.



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SMARTPHONE DEVELOPMENT ARTICLES

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