Retrieve the number of GPS satellites that a BlackBerry device tracks

  1. Import the following classes:
    • javax.microedition.location.LocationProvider
    • javax.microedition.location.Location
  2. Create an instance of a LocationProvider.
    LocationProvider provider = new LocationProvider();
  3. Invoke LocationProvider.getLocation() and assign the value that the method returns to a Location variable.
    Location mylocation = provider.getLocation(-1);
    
  4. Invoke the Location.getExtraInfo() method using the NMEA MIME type as a parameter. The method returns an encoded String that contains information about the number of GPS satellites.
    String encodedStr = mylocation.getExtraInfo("application/X-jsr179-location-nmea"); 
    
  5. To retrieve the GPS satellite information, parse through the information in the returned String value.

Was this information helpful? Send us your comments.