Jake
Jake

Reputation: 356

Why is MvvmCross MvxGeoLocationWatcher not returning speed or bearing?

I've noticed that the MvvmCross framework for Android and iOS MvxGeoLocationWatcher does not return a speed or bearing value. I have seen that the code on Android is commented out for putting these values in the MvxGeoLocation object from the Android Location object, is there a reason for this? Is there something I am missing?

Solved

The following code was missing in the Mvx(Touch/Android)GeoLocationWatcher.

In Android

position.Coordinates.Speed = androidLocation.Speed;
position.Coordinates.Heading = androidLocation.Bearing;

In iPhone

position.Coordinates.Speed = location.Speed;
position.Coordinates.Heading = location.Course;

Upvotes: 0

Views: 380

Answers (1)

Stuart
Stuart

Reputation: 66882

YAGNI is the reason why... Thar code was built for a project that didn't need it.


The current geolocationwatcher is a core implementation only. It was written as part of a project that only needed one-off fairly coarse location information. Some code was also borrowed from chrisntr's mobile extensions project. because that original project didn't need bearing or speed info (and maybe also because some of our test phones misbehaved) then we didn't include that functionality.


If your current project needs more functionality, then the easiest route forwards might be to implement new geolocation watchers matching your needs - you can probably build this code starting from the existing samples.

Another alternative might be to wrap some interfaces around the location code in xamarin's mobile API libraries.

If you do this, then I'd love to see your code pushed back as open source - whether inside mvx, as a plugin or as a separate project.

Ps sorry for the typing... I'm on mobile keyboard....

Upvotes: 1

Related Questions