显示当前位置如何使用onLocationChanged方法android系统
0
A
回答
4
你可以使用LocationManager.getLastKnownLocation()
显示目前所在的位置,但是这只会给你的最后一个已知位置 - 这可能是什么(如果用户只需打开手机)或者数百英里以外的某个地方(如果他们最后一次转换位置服务很远)。
如果你真的想知道用户现在在哪里,你将不得不实现一个LocationListener。
0
使用requestLocationUpdates(),当你到达onLocationChange时,停止它。这就是我的程序所做的,通过这种方式,您可以确保一旦获得新位置,它就会停止查找更新。
相关问题
- 1. alertbox android系统
- 2. 在android系统
- 3. android系统
- 4. 在android系统
- 5. 在android系统
- 6. 让android系统
- 7. 在android系统
- 8. android系统
- 9. android系统
- 10. 在android系统
- 11. android系统
- 12. android系统
- 13. android系统
- 14. android系统
- 15. android系统
- 16. android系统
- 17. android系统
- 18. android系统
- 19. android系统
- 20. android系统xamarin
- 21. NoSuchMethodException android系统
- 22. 在android系统
- 23. android系统
- 24. android系统
- 25. android系统
- 26. 在android系统
- 27. android系统
- 28. android系统
- 29. MultiselectListpreference android系统
- 30. android系统