Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/JarleySoft/CompassPlugin

Compass Plugin for Xamarin and Windows
https://github.com/JarleySoft/CompassPlugin

android ios plugins-for-xamarin uwp xamarin

Last synced: 3 months ago
JSON representation

Compass Plugin for Xamarin and Windows

Awesome Lists containing this project

README

        

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

### Setup
* Available on NuGet: https://www.nuget.org/packages/Plugin.Compass
* Install into your PCL project and Client projects.

**Platform Support**

|Platform|Version|
| ------------------- | :-----------: |
|Xamarin.iOS|iOS 7+|
|Xamarin.Android|API 14+|
|Windows 10 UWP|10+|

### API Usage

**IsSupported**
```csharp
///
/// Determine if Compass is available.
///
bool IsSupported { get; }
```

**Start**
```csharp
///
/// Plugin will begin firing CompassChanged events as they are available
///
void Start();
```

**Stop**
```csharp
///
/// Plugin will stop firing events
///
void Stop();
```

**DirectionChanged Event**
```csharp
///
/// Event fires when updates are available
///
event EventHandler CompassChanged;
```

**CompassChangedEventArgs**
```csharp
///
/// EventArgs included when CompassChanged Event fires (Returns 0-360 degrees)
///
double Heading { get; }
```

### Usage

```csharp

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

label.Text = $"Heading = {e.Heading}";

};

CrossCompass.Current.Start();
```

#### Contributors
* [Carl Barton](https://github.com/JarleySoft)
* [James Montemagno](https://github.com/jamesmontemagno)

Thanks!

#### License
Licensed under MIT see License file