//get current location - 4 tries or bust - in case of invalid fix
BlackBerryLocation myLocation = getGeolocation(4);
// Show location.
if (myLocation != null){
currSelection = new MapPoint(myLocation.getQualifiedCoordinates());
PeerPoint point = new PeerPoint(myLocation.getQualifiedCoordinates().getLatitude(), myLocation.getQualifiedCoordinates().getLongitude());
point.setAccuracy(MathUtilities.round(myLocation.getQualifiedCoordinates().getHorizontalAccuracy()));
//auto zoom to point
map.getAction().setCenterAndZoom(point);
//add the point with accuracy circle
map.getModel().add(point);
}else{
if (_ops != null){
double lat = Double.parseDouble((String) _ops.getField("lat"));
double lon = Double.parseDouble((String) _ops.getField("lon"));
int zoom = Integer.parseInt((String) _ops.getField("zoom"));
//get default location from options
map.getAction().setCenterAndZoom( new MapPoint( lat, lon ), zoom );
}else{
//default location (ottawa with high zoom level)
map.getAction().setCenterAndZoom( new MapPoint( 45.417, -75.7 ), 10 );
}
}
}
catch (Exception e) {
throw new RuntimeException(e.getMessage());