在地图中显示当前位置时获得 0.0 的纬度和经度
本文介绍了在地图中显示当前位置时获得 0.0 的纬度和经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码来获取我的当前位置.但我面临的问题是,纬度和经度总是返回 0.0.我已经打开手机中的GPS设置并设置了所有权限.但我仍然面临这个问题.
I am using the following code to get my current location. But the problem I am facing is, it always returns 0.0 for latitude and longitude. I have turned on the GPS settings in the phone and set all the permissions. But still I am facing this.
你们中有人知道为什么吗?
Do any one of you know why?
注意:我的活动扩展 MapActivity 而不是位置监听器
Note : My activity extends MapActivity not Location Listener
推荐答案
试试这个方法
在 mylocationlistener 中设置你的位置对象
in mylocationlistener set your location object
这篇关于在地图中显示当前位置时获得 0.0 的纬度和经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!