我想获得用户的位置,所以我有这个代码:
LocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MINIMUM_TIME_BETWEEN_UPDATES,
MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("locationManager ", "locationManager ");
/*
* try to get last know location
*/
Location location = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
public void onLocationChanged(Location location) {
this.location=location;
}
而不是我发送地理位置修复:
geo fix -122.41914 37.77919
它在模拟器中运行良好,但是当我在真实设备上尝试时。它不起作用,我看到设备上的GPS图标闪烁。 注意:GPS已在设备上启用。