Select to view content in your preferred language

How to use GPX route to simulate a route with android sdk?

1206
1
Jump to solution
03-12-2021 11:21 AM
JayBowman
New Contributor II

Can I create a simulated route with a GPX file in android like you can with the IOS SDK? I don't see a GPXLocationDataSource like what is in ios SDK.

0 Kudos
1 Solution

Accepted Solutions
MarkBaird
Esri Regular Contributor

You are correct Android doesn't have the GPXLocationDataSource class yet, but there is an easy way of achieving the same.

 

The GPX  file is just an XML file, so if you can open it to get your coordinates you can pass these into a SimulatedDataSource which will show the positions on your LocationDisplay.

There isn't a specific Android sample for using the SimulatedLocationSource class, but you can take a look at the JavaFX (ArcGIS Runtime for Java) sample and you will see how to use it.  Under the covers the Android and Java APIs share quite a lot of the same codebase.

https://github.com/Esri/arcgis-runtime-samples-java/tree/9b611cf5ed977b5c7b33a275d6c06a19838e7b38/ma...

Does this help?

View solution in original post

0 Kudos
1 Reply
MarkBaird
Esri Regular Contributor

You are correct Android doesn't have the GPXLocationDataSource class yet, but there is an easy way of achieving the same.

 

The GPX  file is just an XML file, so if you can open it to get your coordinates you can pass these into a SimulatedDataSource which will show the positions on your LocationDisplay.

There isn't a specific Android sample for using the SimulatedLocationSource class, but you can take a look at the JavaFX (ArcGIS Runtime for Java) sample and you will see how to use it.  Under the covers the Android and Java APIs share quite a lot of the same codebase.

https://github.com/Esri/arcgis-runtime-samples-java/tree/9b611cf5ed977b5c7b33a275d6c06a19838e7b38/ma...

Does this help?

0 Kudos