1

I am working on a Navigation App and I am using ArcGIS runtime sdk for this. It looks pretty straight forward and I was able to create a simple app. Now I want to calculate the speed of the device while navigating. I was wondering if that is possible or not as I did not find anything in this regard in ArcGIS documentation.

1

we can use the inbuilt method loc.getSpeed() method inside the onLocationChanged(Location loc) method of LocationListener. below is the code block:

private class MyLocationListener implements LocationListener {

    public MyLocationListener() {
        super();
    }


    public void onLocationChanged(Location loc) {
        if (loc == null)
            return;
        boolean zoomToMe = (mLocation == null) ? true : false;
        mLocation = new Point(loc.getLongitude(), loc.getLatitude());
        if (zoomToMe) {
            Point p = (Point) GeometryEngine.project(mLocation, egs, wm);
            map.zoomToResolution(p, 20.0);
            Toast.makeText(RoutingSample.this,Float.toString(loc.getSpeed()) , Toast.LENGTH_LONG).show();

        }
    }
}
|improve this answer|||||
0

Basically you need distance traveled over time whereby the device GPS will be most accurate for distance traveled. You can use the ArcGIS Android LocationDisplayManager.getLocationListener() to get an Android LocationListener to receive notification of when location has changed. You can also get direct access to the current Location with LocationDisplayManager.getLocation().

|improve this answer|||||
  • Thanks mate but I figured it out and it is even easier than this. we can use the inbuilt method loc.getSpeed() method inside the onLocationChanged(Location loc) method of LocationListener. – Puneetr90 Aug 20 '14 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.