0
我想从我开发的Android应用程序发送当前位置到服务器,但提供程序总是发送相同的位置,而不是我可以看到点标记的位置。安卓地图总是返回相同的位置
我请求位置更新这样的:
// Getting LocationManager object from System Service LOCATION_SERVICE.
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
// Creating a criteria object to retrieve provider.
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
criteria.setBearingRequired(true);
// Getting the name of the best provider.
String provider = locationManager.getBestProvider(criteria, true);
locationManager.requestLocationUpdates(provider, 2, 2, this);
,我得到lat和长这样:
public void onLocationChanged(Location location) {
Location currentLocation;
Location nextLocation;
if (MapVisible == true) {
// Creating a LatLng object for the current location.
latitude = location.getLatitude(); <--------here
longitude = location.getLongitude(); <--------here
...
但是服务器总是收到相同的位置。有关该问题的任何提示? 谢谢