我试图使用GPS提供商获取当前位置。GPS提供商返回空值
- 但据我所知它工作不正常。在网络提供商的情况下,它返回塔值,不完全是卫星值。
- 在这里,我附上了一些与GPS提供商相关的代码示例。
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f,this);
public void onLocationChanged(Location location) {
if (location != null) {
double lat = location.getLatitude();
double lng = location.getLongitude();
String currentLocation = "Lat: " + lat + " Lng: " + lng;
txted.setText(currentLocation);
p = new GeoPoint((int) lat * 1000000, (int) lng * 1000000);
mc.animateTo(p);
}
}
public void onProviderDisabled(String provider) {
// required for interface, not used
}
public void onProviderEnabled(String provider) {
// required for interface, not used
}
public void onStatusChanged(String provider, int status, Bundle extras) {
// required for interface, not used
}
它已经在On State –