Tuesday, 15 January 2013

gps - Android - Locations got from LocationClient doesn't support speed -


I am using the new Google LocationClient to recover the geographic location. And I need to get the speed for each point (space).
What I am doing now:

  if (mLocationClient == faucet) {mLocationClient = new location client (this, mLocation callback, mLocation callback); MLocationCallback.setLocationClient (mLocationClient); If (MLocationClient.isConnected ()) || mLocationClient.isConnecting ())) {mLocationClient.connect (); }}   

Where mLocation is an example of callback

  Public class space calculator applies the connection callback, on connectionfield listener, location listener {}  Public zero transfer (location location) in the  

function,

  @Orride {if (location == null) {Log.e (TAG, "onLocationChanged: location = = Null "); Return; } "+ Location.getAltitude () +" ("+ location.hasAltitude () +" ("location @" + location.getlighttime (+) + "," + location.getLongitude () + ", height: ")" + "Velocity:" + location.getSpeed ​​() + "m / s (" + location.has speed +++ ");}}   

However, every time the location.hasSpeed ​​() returns false . It seems that only the GPS provider provides the speed I'm sure my GPS is on but its Can not be used any way to apply the location client to use GPSClient Is there a way to use the GPS provider to be the location client?

No, because it can point to the LocationClient to multiple sources (GPS, WiFi, cell tower, sensor, etc.).

If needed, use LocationManager and work with GPS_PROVIDER , or criteria is the speed (like, Galileo, someday, maybe ).

No comments:

Post a Comment