我定义了GPS坐标。我已经创建了一个onLocationChanged应用程序 - 接收位置。这样可行。现在我想提高获得灵魂和精确坐标的速度。如何获得精确的GPS坐标并快速?
我怎样才能获得准确的GPS坐标,并迅速?
我定义了GPS坐标。我已经创建了一个onLocationChanged应用程序 - 接收位置。这样可行。现在我想提高获得灵魂和精确坐标的速度。如何获得精确的GPS坐标并快速?
我怎样才能获得准确的GPS坐标,并迅速?
阅读雷托Meiers“深潜到位置”:
http://android-developers.blogspot.de/2011/06/deep-dive-into-location.html
短版:你得到了什么操作系统为您提供不或多或少
我希望这可以帮助你,试试这个:
LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
mlocListener);
public class MyLocationListener implements LocationListener {
@Override
public void onLocationChanged(Location loc) {
loc.getLatitude();
loc.getLongitude();
Geocoder gcd = new Geocoder(getApplicationContext(),
Locale.getDefault());
try {
mAddresses = gcd.getFromLocation(loc.getLatitude(),
loc.getLongitude(), 1);
} catch (IOException e) {
}
String cityName = (mAddresses != null) ? mAddresses.get(0)
.getLocality() : TimeZone.getDefault().getID();
String countryName = (mAddresses != null) ? mAddresses.get(0)
.getCountryName() : Locale.getDefault().getDisplayCountry()
.toString();
mCurrentSpeed.setText(loc.getSpeed());
}
@Override
public void onProviderDisabled(String provider) {
Toast.makeText(getApplicationContext(), "Gps Disabled",
Toast.LENGTH_SHORT).show();
}
@Override
public void onProviderEnabled(String provider) {
Toast.makeText(getApplicationContext(), "Gps Enabled",
Toast.LENGTH_SHORT).show();
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
}
噢谢谢你,我一直在寻找这篇文章 –
“在剩余的空闲时间,我骑着山地自行车在附近的森林。” - ) –
好吧,不仅在附近的森林 - 我也去河流:http://www.youtube.com/watch?v=hv_uu_YOmE4 –