I have an .net Xamarin Map app that I created using a .net Standard class library for all my shared code, Xamarin forms. How do i get a reference to a SystemLocationDataSouce that is only available in the android or IOS project.
FYI once update 9 ships, from a .NET Standard library you'll be able to call: LocationDataSource.CreateDefault() to get a location-datasource for the platform. Until then you can use the code snippet I linked to above.
We should make that easier I agree. Currently that API is only available for platform-specific code, and not part of the .NET Standard API surface.
For now you can do what I did here:
arcgis-toolkit-dotnet/ContinuousGPSSample.xaml.cs at master · Esri/arcgis-toolkit-dotnet · GitHub
This should return a value when running on Xamarin.iOS, Xamarin.Forms, UWP, .NET Core and .NET Framework (even if you compiled for .NET Standard).
Not 100% sure what you mean bu get a reference to...
SystemLocationDataSource is a device dependent implementation of LocationDataSource, so having the class available in the .net shared Xamarin library is not be possible.
However, in my shared project the property mapView.LocationDisplay.DataSource will be the SystemLocationDataSource for the currently running platform
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.