For Baidu Map has really unbearable, the laboratory two years ago a project used to Baidu map, before seniors graduated, I to maintain this broken project, Baidu Map launched a new version, the old version of the API can not be used, you can not be backward compatible? Replace a small number of API also forget, incredibly overall style has changed,
Grandpa's, I have to learn the old version of the API to understand the code, and then learn the new version of the API to modify the project, this is nothing, however, your new version of the official demo how to stay bug!! Toss a day later found that this is Baidu Android Location SDK Bug, not my own code of the problem feel very wonderful have wood!!!
Use the Baidu website to provide the demo learning, found a bug
//high-precision positioning mode: This positioning mode, the use of network positioning and GPS positioning, priority to return to the highest precision positioning results;
Option.setlocationmode (Locationclientoption.locationmode.hight_accuracy);
positioning results: Latitude: 4.940656E-318 longitude 4.940656E-318 (this latitude and longitude anyway on earth is not, maybe on Mars there, I read less)
After all kinds of tossing, after suspecting life, I no longer doubt the code, I began to doubt whether this version of the Location SDK has a problem,
Baidu API provides the following two types of positioning mode,
//low-Power positioning mode: This positioning mode will not use GPS, only use network location (Wi-Fi and base station location);
Option.setlocationmode (Locationclientoption.locationmode. battery_saving);
Use only device positioning mode: This positioning mode, no need to connect to the network, only GPS positioning, this mode does not support indoor environment positioning.
Option.setlocationmode (Locationclientoption.locationmode. Device_sensors);
I changed the code to the bottom of this, only using the device's own GPS positioning;
After the change, get outdoors, positioning success,
Comprehensive: The new version of Baidu Android positioning SDK v6.1.3 network location has a bug, but fortunately this project is outside the collection set up stations, there is no WiFi, the basic is the use of GPS positioning.
Found the latest version of Baidu Android positioning SDK v6.1.3 network location bug