How to read the current location in a blackberry a

2019-08-13 19:59发布

问题:

How do I read the latitude and longitude of current location in a black berry application?

回答1:

Look at using these classes: LocationProvider, Location, QualifiedCoordinates.

LocationProvider provider = LocationProvider.getInstance(null);
Location loc = provider.getLocation(-1);
QualifiedCoordinates qc = loc.getQualifiedCoordinates();
//Call getLatitude() and getLongitude() in QualifiedCoordinates object.