Smartphone Development
  Home arrow Smartphone Development arrow How to Incorporate Location into Your BlackBerry Applications
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
SMARTPHONE DEVELOPMENT

How to Incorporate Location into Your BlackBerry Applications
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2009-08-20


    Table of Contents:
  • How to Incorporate Location into Your BlackBerry Applications
  • Getting Information via PDE
  • Display Our Data
  • Creating the Location Document

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    How to Incorporate Location into Your BlackBerry Applications
    ( Page 1 of 4 )

    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.

    Before we delve in any further into this article, I am going to assume that you are already familiar with programming basic BlackBerry applications, and that you have the required development environments and simulators installed on your computer. If not, I suggest taking a peek at BlackBerry's Developer Zone to get up to speed.

    GPS Information and the BlackBerry

    Not all BlackBerry devices support GPS (Global Positioning System) technology, but on the ones that do, applications exist that allow the user to display their current position on a map in real time. In addition, applications can supply directions, both textual and image-driven, and suggest alternate routes. They can even give the user satellite and street level imagery. To achieve these wonders, BlackBerry applications rely on the Location API for Java Platform (JSR 179). We will be working with this JSR throughout the remainder of this article.

    For starters, we will look at methods and modes used to obtain local GPS information. There are three Location modes available to use. The first is cell site, which lets us retrieve information from cell site towers and the strength of the user's signal. Of all the location modes, this method is the fastest, but be forewarned - that speed comes with a disadvantage: the accuracy is sub-par and you cannot obtain speed or routing information. Note that cell site support depends on the carrier.

    To get location information using the cell site mode, create a new Criteria object, like so:

    Criteria criteria = new Criteria():

    Next you will need to Invoke the following:

    criteria.setHorizontalAccuracy(NO_REQUIREMENT); //this tells the program that there is no requirement for longitude accuracy

    criteria.setVerticalAccuracy(NO_REQUIREMENT); //the same as above, but with regards to latitude

    criteria.setCostAllowed(true); //specifies that the cell site mode can result in a fee

    setPreferredPowerConsumption(POWER_USAGE_LOW); //set the power consumption to low

    After this you will need to invoke LocationProvider.getInstance(), which in turn stores the information in a LocationProvider object. To do so, type in the following:

    LocationProvider provider = LocationProvider.getInstance(criteria);



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

       

    SMARTPHONE DEVELOPMENT ARTICLES

    - Getting Started with Rich Media
    - How to Incorporate Location into Your BlackB...
    - Building Business Apps with the BlackBerry B...
    - The BlackBerry Java Development Environment ...
    - Advanced Java Programming for BlackBerry Sma...
    - Learning Java Application Development
    - Programming Intuitively with the BlackBerry ...
    - Simulating a BlackBerry Device
    - Data Types and Data Retrieval with BlackBerry
    - Debugging Your BlackBerry Applications
    - What You Need to Know to Get Started as a Bl...
    - Comparing RIM and JAVA ME APIs
    - Advanced BlackBerry Browser Development
    - Introducing the BlackBerry Push API
    - Developing the BlackBerry Browser




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek