private void Initmap () {
Positioning initialization
Mlocclient = new Locationclient (this);
Mlocclient.registerlocationlistener (MyListener);
locationclientoption option = new Locationclientoption ();
Option.setopengps (TRUE);//Turn on GPS
Option.setcoortype ("Bd09ll"); Set the coordinate type
Setscanspan < 1000 is the app active request location;
setscanspan>=1000, the Timed positioning mode (the value of Setscanspan is the time interval of the timed position))
In the timed positioning mode, the Positioning SDK will update the location according to the time position set by the app, and the callback location result is timed.
Http://developer.baidu.com/map/index.php?title=android-locsdk/qa
Option.setscanspan (1000);
mlocclient.setlocoption (option);
Mlocclient.start ();
}
by Baidu Map (above) to get the current coordinates, displayed on the navigation map, the position will be offset
Workaround (obtained with Locationmanager location manager):
Locationmanager lm = (locationmanager) getsystemservice (Context.location_service);
Location location = lm.getlastknownlocation (Locationmanager.gps_provider);
double longitude = Location.getlongitude ();
double latitude = Location.getlatitude ();
Set the latitude and longitude obtained by the Locationmanager location Manager to the navigation map to display the current position (smaller offset)
This article from "Rookie of the Mind Course" blog, reproduced please contact the author!
Android via Baidu Map location to get coordinates in the navigation map above the display, coordinates are shifted