0 rating
  • 1
  • 2
  • 3
  • 4
  • 5
Compatible with
  • Android
  • iOS

XM.GeoLocation 1.0.2

xamarians

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

Xamarians.GPS

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

First add component from xamarin component.

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

Release Notes

Position can be obtained without turning on the continuous listening.

Be the first to write a review