Home

Awesome

Compass Plugin

Provides and simple way to access the compass on iOS, Android, and Windows. Returns 0-360 degrees

Setup

Platform Support

PlatformVersion
Xamarin.iOSiOS 7+
Xamarin.AndroidAPI 14+
Windows 10 UWP10+

API Usage

IsSupported

/// <summary>
/// Determine if Compass is available.
/// </summary>
bool IsSupported { get; }

Start

/// <summary>
/// Plugin will begin firing CompassChanged events as they are available
/// </summary>
void Start();

Stop

/// <summary>
/// Plugin will stop firing events
/// </summary>
void Stop();

DirectionChanged Event

/// <summary>
/// Event fires when updates are available
/// </summary>
event EventHandler<CompassChangedEventArgs> CompassChanged;

CompassChangedEventArgs

/// <summary>
/// EventArgs included when CompassChanged Event fires (Returns 0-360 degrees)
/// </summary>
double Heading { get; }

Usage

 
CrossCompass.Current.CompassChanged += (s, e) =>
{
    Debug.WriteLine("*** Compass Heading = {0}", e.Heading);
    
    label.Text = $"Heading = {e.Heading}";
   
};

CrossCompass.Current.Start();

Contributors

Thanks!

License

Licensed under MIT see License file