Custom LocationDataSource map refresh

758
2
08-30-2019 12:43 PM
JoeHershman
MVP Regular Contributor

I have a Xamarin Forms app with using a custom LocationDataSource receiving data from an external gps unit.  Things seem to work in terms of getting data and updates being seen in the appropriate event handlers.  However, the display symbol location does not update as I walk around.  Occasionally, it will jump back over to my location but in general it just stays at the location when I opened the map.  When I go out and come back into to a view (which means a new MapView would be created, I will be at the correct location which is further evidence that I am receiving the correct location data.

I setup something to flip back to using the SystemLocationDataSource and when this is done the indicator follows as expected.

Is there something I am missing that would need to be triggered in a custom LocationDataSource  so that the MapView is refreshed?

[I did have an application running in WPF which used basically the identical LocationDataSource - although the source of the stream was different - and in this case had the correct behavior)

Thanks

-Joe

Thanks,
-Joe
Tags (1)
0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

It's had to say without seeing your code, but typically, all you need to do is call base.UpdateLocation(...) with the new location. I wonder if there's something on the location you're sending that is throwing it off or making it not work (like invalid values, ie NaN, negative speed, invalid course etc - those things should be handled or throw argument exceptions, but could be it gets swallowed or something).

0 Kudos
JoeHershman
MVP Regular Contributor

After many headaches I was able to track down that the way I was receiving and parsing the data stream from the external unit on a background thread was not working as expected.  What was happening was that sentences were getting lost and not sent over to the LocationDataSource implementation.  For some reason it seems like the GGA and RMC sentences got lost the most often (although I think just some random math because there are so many GSV sentences in relation to everything else). 

I was able to change this around so now all sentences get passed in to the LocationDataSource implementation and things seem to be behaving.  I was originally using an approach I took from WPF, but enough differences in how iOS ExternalAccessory processes compared to bluetooth in WPF that additional changes were required

Thanks

Joe

Thanks,
-Joe
0 Kudos