为什么GPS在Android设备中旅行时返回相同的纬度和经度?

为什么GPS在Android设备中旅行时返回相同的纬度和经度?,android,gps,Android,Gps,在我的应用程序中,使用报警管理器在某个时间间隔内获取位置。这是密码 在LocationListenStart.java(它是BroadcastReceiver类)中:- 在LocationReceiver.java中:- public class LocationReceiver extends BroadcastReceiver { String locationKey = ""; double mlatitude=0.0; double mlongitude=0.0;

在我的应用程序中,使用报警管理器在某个时间间隔内获取位置。这是密码

在LocationListenStart.java(它是BroadcastReceiver类)中:-

在LocationReceiver.java中:-

public class LocationReceiver extends BroadcastReceiver
{
   String locationKey = "";
   double mlatitude=0.0;
   double mlongitude=0.0;
   public void onReceive(Context context, Intent intent) 
   {
     locationKey = LocationManager.KEY_LOCATION_CHANGED;
     if (intent.hasExtra(locationKey)) 
     {
        mlatitude = location.getLatitude();
        mlongitude = location.getLongitude();
     }
     if(LocationListenStart.locationManager != null)
     {
        LocationListenStart.locationManager.removeUpdates(LocationListenStart.pendingIntent);
     }
   }
}
我在HTC设备上测试过这个应用程序,有时候它在旅行时会发送重复的位置,
如果我旅行2小时,当我尝试使用5小时的连续旅行时,它不会得到相同的lat和long值。复制位置发送3到5分钟。有时在GPS不可用时获取重复位置。但在三星设备中,这个问题并没有发生,HTC设备只是遇到了这个问题。如何解决这个问题

您还可以设置:
locationManager.requestLocationUpdates(locationManager.GPS\u提供程序、最短时间\u BW\u更新、最短距离\u更改\u更新,此选项)
requestLocationUpdates()方法已使用并测试该方法在HTC Desire U设备中完全不起作用。但其他设备如何?我已在三星和HTC两台设备中进行了测试,在三星,一切正常,但HTC遇到了问题。因为所有的Android手机都有不同的GPS定位传感器,而且所有的设备都按照要求定制了他们的Android系统等级。索尼总是定制所有的Android系统等级
public class LocationReceiver extends BroadcastReceiver
{
   String locationKey = "";
   double mlatitude=0.0;
   double mlongitude=0.0;
   public void onReceive(Context context, Intent intent) 
   {
     locationKey = LocationManager.KEY_LOCATION_CHANGED;
     if (intent.hasExtra(locationKey)) 
     {
        mlatitude = location.getLatitude();
        mlongitude = location.getLongitude();
     }
     if(LocationListenStart.locationManager != null)
     {
        LocationListenStart.locationManager.removeUpdates(LocationListenStart.pendingIntent);
     }
   }
}