I am trying to determine the most accurate location of the device in the shortest possible time.
I store the data as a geolocation and display it on a map.
The last time I activated GPS on my device and let it set the location lock, I was about 80 miles from where I am now.
I have a location manager setup and a location listener.
If I do this, I will get NULL.
myLocOverlay = new MyLocationOverlay(this, mapView);
GeoPoint test = myLocOverlay.getMyLocation();
but in the next two lines;
myLocOverlay.enableMyLocation();
mapView.getOverlays().add(myLocOverlay);
In this case, the overlay on the map shows the current location. He is using a network provider, but is also trying to get a GPS fix (he cannot, because I'm in a room and not where the top floor is).
If I build the geodata as follows:
if(lm.getLastKnownLocation("gps") != null)
{
test = new GeoPoint(
(int) (lm.getLastKnownLocation("gps").getLatitude() * 1E6),
(int) (lm.getLastKnownLocation("gps").getLongitude() * 1E6));
}
else
{
if(lm.getLastKnownLocation("network") != null)
{
test = new GeoPoint(
(int) (lm.getLastKnownLocation("network").getLatitude() * 1E6),
(int) (lm.getLastKnownLocation("network").getLongitude() * 1E6));
}
}
. GPS-, . GPS, , GPS.
;
GeoPoint test = myLocOverlay.getMyLocation();
, , NULL .
GPS , GPS, , 1 - . getMyLocation(), GeoPoint , myLocOverlay ?