Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 2nd, 2012  |  syntax: None  |  size: 1.17 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. get current locaion from GPS in Blackberry application
  2. private class LocationListenerImpl implements LocationListener {  
  3.     public void locationUpdated(LocationProvider provider, Location location) {  
  4.         if (location.isValid()) {  
  5.             heading = location.getCourse();  
  6.             longitude = location.getQualifiedCoordinates().getLongitude();  
  7.             latitude = location.getQualifiedCoordinates().getLatitude();  
  8.             altitude = location.getQualifiedCoordinates().getAltitude();  
  9.             speed = location.getSpeed();  
  10.  
  11.             // This is to get the Number of Satellites  
  12.             String NMEA_MIME = "application/X-jsr179-location-nmea";  
  13.             satCountStr = location.getExtraInfo("satellites");  
  14.             if (satCountStr == null) {  
  15.                 satCountStr = location.getExtraInfo(NMEA_MIME);  
  16.             }  
  17.  
  18.             // this is to get the accuracy of the GPS Cords  
  19.             QualifiedCoordinates qc = location.getQualifiedCoordinates();  
  20.             accuracy = qc.getHorizontalAccuracy();  
  21.         }  
  22.     }  
  23.  
  24.     public void providerStateChanged(LocationProvider provider, int newState) {  
  25.         // no-op  
  26.     }  
  27. }