Getting and monitoring the GPS location for each platform is a common capability. Every smartphone in the market right now has a GPS sensor built in, but each OS has its own native APIs to retrieve the position.
The good news is that you don't have to create a plugin as there is one already created by James Montemagno from Xamarin that you can freely use.
Create a Blank App (Xamarin.Forms Portable) cross-platform mobile solution named
XamFormsQueryGps
in Visual Studio with File | New | Project….Right-click all the projects one by one and choose Manage NuGet Packages to search and install
Xam.Plugin.Geolocator
.Go to the
XamFormsQueryGps
portable library and open theApp.cs
file; add the following code to the file:Label gpsLabel; public App() { IGeolocator locator = DependencyService.Get<IGeolocator>(); locator.DesiredAccuracy = 50; locator.AllowsBackgroundUpdates = true; locator.StartListening(1, 1, true); locator.PositionChanged += LocatorPositionChanged...