How to use external gps location data

13366
34
Jump to solution
05-03-2018 10:02 PM
ShiminCai
Occasional Contributor III

Hi All,

I have a new requirement for our apps to use external gps location updates (Bad Elf GPS Unit) besides the default Apple location service updates. I understood that I need to create a custom location display data source class that conforms to the protocol <AGSLocationDisplayDataSource> and replace the mapVidw.locationDisplay.dataSource. My question is that: how do I implement the start method in the  protocol of <AGSLocationDisplayDataSource>? I'm currently still on 10.2.5 and later will look at the 100.2.1 as well. Can anyone please shed any light on this or have any working code to share? Many thanks for your help.

Cheers,

Shimin

34 Replies
JoeHershman
MVP Regular Contributor

I was finally able to get a handle on your posted code which was really helpful.  I am doing in Xamarin so things need to be architected differently because of how you need to access platfom dependent code from the shared projects.  I am pretty close but for one issue.  I call Open on the InputStream but my Handle method only gets a called a few times, seems like something is going out of scope but I am holding onto references.  Hoping I can figure it out soon, for the few cycles everything goes through the data is being read and everything looks good from the MapView side

Thanks

-Joe

Thanks,
-Joe
0 Kudos
JoeHershman
MVP Regular Contributor

Was something on my end hanging up the application which blocked the thread.

Thanks for all the information you posted, this was key to getting me working 

Thanks,
-Joe
0 Kudos
ShiminCai
Occasional Contributor III

Glad it helps. Cheers, Shimin

0 Kudos
JoeHershman
MVP Regular Contributor

Divesh Goyal‌ I am working on an app using an external GPS, it's in Xamarin but I assume things would work the same.  What I am trying to figure out is how would I know which is the source of the location data.  I can check the accuracy which should give me an idea, but I don't see anything in from either native iOS or from Xamarin that would tell me what the provider is.

Looking at Collector as an example it gives you the option to connect to a location provider.  I would think based on that, that there is a way to detect the connected location sources.  Again, though I can just not find where that is.  I have played around with using some bluetooth libraries without luck.

I have written a custom LocationDataSource in WPF using the same device we are trying to use in iOS   In that case I was able to directly connect to the bluetooth device and capture data.  Just does not seem to be working in iOS

Any thoughts?

Nicholas Furness

Thanks,
-Joe
0 Kudos
Nicholas-Furness
Esri Regular Contributor

Hi Joe Hershman,

If you look at the dataSource property on the MapView.locationDisplay (iOS, Xamarin), that will tell you what's providing the data. On iOS, for example, it is by default an instance of the AGSCLLocationDataSource. If you implement your own data source as described above, then you can just get hold of that instance.

0 Kudos
JoeHershman
MVP Regular Contributor

If the external source has 'taken over' as the default provider the DataSource it still the SystemLocationDataSource (.net).  I was finally able to get what I needed thanks to all the info at Shimin Cai‌ had posted about using the EAAccessory & NSStreamDelegate.  Takes some extra stuff to wire to work with Xamarin Forms but it is all working now

Thanks,
-Joe
MuruganandhamKuppan1
New Contributor III

Hi @Nick, Its working for me.. thanks

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Thanks Muruganandham Kuppan‌. Great to hear. Could you mark your original question as answered please? It'll help other people home in on the right answer.

Nicholas-Furness
Esri Regular Contributor

I've since written a series of blog posts that delve into working with Location Display and Location Data Sources:

They discuss the blue dot, how Runtime works with it, and creating custom location data sources.

0 Kudos
DuanePfeiffer
New Contributor III

I see there is an out-of-the-box NMEALocationDataSource.  I have been able to use it successfully until the app gets backgrounded.  When the app becomes active, I no longer get data even though the external gps is still working and connected via bluetooth.  Do I need to implement my own location data source?

0 Kudos