I am getting so frustrated. My code works fine on the emulator, but when running on an actual Nextel 7520, it fails. Here is my code:
Quote:
public class GeoPointLocator {
public static GeoPoint locate() throws Exception {
// keep testing the hardware until we get a good result
while (true) {
Criteria cr = new Criteria();
// cr.setSpeedAndCourseRequired(true);
// cr.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
// cr.setPreferredPowerConsumption(Criteria.NO_REQUIR EMENT);
LocationProvider lp = LocationProvider.getInstance(cr);
if (lp == null) {
return new GeoPoint(0.0, 0.0, 0);
}
Location l = lp.getLocation(-1);
Coordinates c = l.getQualifiedCoordinates();
if (c != null) {
double latitude = c.getLatitude();
double longitude = c.getLongitude();
return new GeoPoint(latitude, longitude, 0);
}
}
}
|
It dies at the bold line. I am running this code within a thread. The 7520 OS is at v4.1.0.273
HELP!