【发布时间】:2015-03-30 10:56:42
【问题描述】:
我编写了一个程序,它提供用户在建筑物中的位置,而不是实际位置。我知道 Gps 在建筑中不能提供高精度的结果。我的代码如下:
public class Internet extends Service implements LocationListener {
Context context;
LocationManager locationManager;
public Internet(Context context) {
this.context = context;
locationManager = (LocationManager) context
.getSystemService(Context.LOCATION_SERVICE);
}
Location findMeInternet() {
Boolean isInternet = false;
Location location;
isInternet = locationManager
.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if (isInternet) {
locationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER, 3, 1, this);
if (locationManager != null) {
location = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
return location;
}
}
return null;
}
//other override methods with empty bodies .
}
【问题讨论】:
-
你有什么问题?
-
我的问题是位置不是实际位置!
标签: android gps geolocation