100.1 External GPS Quirk

219
6
08-28-2017 03:46 PM
Regular Contributor

Not all of my Runtime users have internal GPS yet, and while porting my serial GPS code from 10.2.7 to 100.1, I've noticed an odd quirk.  When the location display is first enabled by the application, it doesn't always display the valid locations coming in.  Disabling and re-enabling fixes the problem, so as a workaround I added this snippet after the first valid point is collected and sent to the display:

_ld.IsEnabled = false;
Thread.Sleep(100);
_ld.IsEnabled = true;

Has anyone else seen this?

Tags (2)
Reply
0 Kudos
6 Replies
Esri Frequent Contributor

That's hard to say. It could be the custom implementation. Can you share your GPS implementation?

Here's another example of a custom GPS location provider for reference:
https://github.com/dotMorten/NmeaParser/blob/ArcGISLocationProvider/src/SampleApp.Store/SampleApp.St...

Reply
0 Kudos
Regular Contributor

Sure thing!  Here it is.

I looked your 10.2.x sample ages ago, and my 10.2.x version works fine.  However, I could not get your 100.x sample to work at all with my puck.

Reply
0 Kudos
Esri Frequent Contributor

A few theories...

You might risk the device is getting started twice. The second call to InitializeAsync  should return the same task (you don't really need to use Task.Factory.StartNew though, since all your start code is synchronous).

Same goes for StopAsync

You're replacing the LocationChanged event. I'm not sure why you do that? The base event will raise when you call 'base.UpdateLocation'.

I'm curious what problems you were having with the 100.x sample. Did you configure it with the right port settings?

Reply
0 Kudos
Regular Contributor

I use tasks to help keep the app from locking.  Good call on LocationChanged -- I was still thinking in terms of ILocationProvider.  Even after renaming it, though, the point display problem persists.

Re your example, I tracked it to horizontal accuracy is NaN, which the location constructor doesn't accept.  I ran into that problem myself, and substitute 0 on those occasions.  I updated the example on my end and it works now.

Reply
0 Kudos
Regular Contributor

I was able to duplicate the problem with your example by setting AutoPan to "Recenter" and horizontal accuracy, speed, and course all to 0.

Reply
0 Kudos
Regular Contributor

Looks like one workaround is to set the velocity to a non-zero number (e.g. 0.1).  Of course, that affects which symbol is displayed.  [If I set UseCourseSymbolOnMovement to false, the problem persists.]

Reply
0 Kudos