Developing with the Google map API is a tangle
When getlastknownlocation () is used, the value cannot be obtained inexplicably. If it is null, then it is inexplicably better. After debugging for a long time, it is useless. If you go online to find information, you will get an answer from the previous article.
So let it survive in the future.
Locationmanager = (locationmanager) getsystemservice (context. location_service); Criteria = new criteria (); criteria. setaccuracy (criteria. accuracy_fine); string provider = locationmanager. getbestprovider (criteria, true); locationmanager. requestlocationupdates (provider, 2000, 0, this );
Mostrecentlocation = locationmanager. getlastknownlocation (provider );
You don't need to write more of these six sentences!
At the same time, the current location is not accurate. I don't know how Google uses it. Is it because I have not practiced enough?
After testing, we found that,
Add a while (mostrecentlocation = NULL)
So it will keep searching, and it will be found in about 3 minutes, so be patient.
If you are confused, try it !!
In the end, I still want to develop JS web pages. Why should I withdraw it to Android Java?
My thinking is sometimes correct, that is, I cannot grasp the details, and I am inexplicably excited about the inexplicable bugs. I have no patience in solving these problems.
This is a problem!