//get current location
BlackBerryCriteria myCriteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
BlackBerryLocation myLocation = null;
try {
BlackBerryLocationProvider myProvider = (BlackBerryLocationProvider)
LocationProvider.getInstance(myCriteria);
myLocation = (BlackBerryLocation)myProvider.getLocation(-1);
if (myLocation.isValid()) return myLocation;
else return getGeolocation(numTries-1);
} catch (LocationException e) {
//possible no towers found
e.printStackTrace();