Issue
I am taking the location using location manager in android like this:
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location lastKnownLoc = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
geoPoint= new GeoPoint((int) (lastKnownLoc.getLatitude()*1000000),(int) (lastKnownLoc.getLongitude())*1000000);
And setting the map view to this coordinate:
myMC = myMapView.getController();
myMC.setCenter(geoPoint);
But the place that i got is the actual place where the location is. When i give the coordinates to google maps on https://maps.google.com/ i got the actual place. Why this occurs like this? Can anyone help me please?
Thanks
Solution
You are getting the last known location. Not the current location.
http://developer.android.com/guide/topics/location/obtaining-user-location.html#Updates
Thats shows you how to get the current location and gives some sample code.
This question would suggest the geopoint is not calculated correctly
Answered By - jiduvah
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.