0
经纬度值,我用下面的代码来找到我的Android应用程序的经度和纬度问题在获得使用GPS在不同的位置
public double[] getlocation() {
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
List<String> providers = lm.getProviders(true);
Location l = null;
for (int i = 0; i < providers.size(); i++) {
l = lm.getLastKnownLocation(providers.get(i));
if (l != null)
break;
}
double[] gps = new double[2];
if (l != null) {
gps[0] = l.getLatitude();
gps[1] = l.getLongitude();
}
return gps;
}
我得到了准确或精确的经度和纬度第一时间我尝试从距离我的第一个位置一英里远的地方获得新的坐标后运行应用程序,但我获得了相同的经度和纬度。
所以请你能告诉我这个问题是如何发生的。这是什么解决方案?
请在这里放置lm.getProvider()方法代码。或者在这里写入requestUpdateLocation()方法代码 – Pratik