Retrieve the number of GPS satellites that a BlackBerry device tracks
- Import the following classes:
- javax.microedition.location.LocationProvider
- javax.microedition.location.Location
- Create an instance of a LocationProvider.
LocationProvider provider = new LocationProvider();
- Invoke LocationProvider.getLocation() and assign the value that the method returns to a Location variable.
Location mylocation = provider.getLocation(-1);
- 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");
- To retrieve the GPS satellite information, parse through the information in the returned String value.
Was this information helpful? Send us your comments.