/Xamarians.GPS

Primary LanguageC#MIT LicenseMIT

Xamarians.GPS

Cross platform library to get current location and to continuesly listen to location

First install package from nuget using following command -

Install-Package Xamarians.GPS -Version 1.0.1

You can integrate locator in you Xamarin Form application using following code:

Shared Code -

To set accuracy-

 GPSService.Instance.DesiredAccuracy = 100;

It get current position-

var postion = await GPSService.Instance.GetPositionAsync(CancellationToken.None);

To start listening to position continuously-

 GPSService.Instance.StartListening(1000, 5);

To stop listening to position-

 GPSService.Instance.StopListening();

To handle when position is changed

  GPSService.Instance.PositionChanged += Instance_PositionChanged;

Android - in MainActivity file write below code -

Xamarians.GPS.Droid.GPSServiceAndroid.Initialize(this);

iOS - in AppDelegate file write below code -

Xamarians.GPS.iOS.GPSServiceIOS.Initialize();

Also add following permissions in Android.

ACCESS_FINE_LOCATION
ACCESS_COARSE_LOCATION
ACCESS_NETWORK_STATE
ACCESS_WIFI_STATE

And following permissions in iOS.

Location Always Usage Description
Privacy - Location Usage Description

For any issue with library please report here

https://github.com/Xamarians/MediaPlayer/issues/new