Home

Awesome

UPDATE - This library has now moved to the Shiny Framework at https://github.com/shinyorg/shiny

ACR Geofence Plugin for Xamarin & Windows

A cross platform library for Xamarin & Windows that allows for easy geofence detection

PLATFORMS

PlatformVersion
Xamarin.iOSiOS 6+
Xamarin.AndroidAPI 10+
Windows 10 UWP10+

SETUP

Be sure to install the Plugin.Geofencing nuget package in all of your main platform projects as well as your core/NETStandard project

NuGet

Android

Add the following to your AndroidManifest.xml

<!--this is necessary for Android v6+ to get the device name and address-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

iOS

Add the following to your Info.plist

<key>NSLocationAlwaysUsageDescription</key>
<string>Your message</string>

UWP

Add location to your app manifest capabilities section

<Capabilities>
    <DeviceCapability Name="location" />
</Capabilities>

HOW TO USE

To start monitoring

CrossGeofences.Current.StartMonitoring(new GeofenceRegion( 
    "My House", // identifier - must be unique per registered geofence
    Center = new Position(LATITUDE, LONGITUDE), // center point    
    Distance.FromKilometers(1) // radius of fence
));

Wire up to notifications

CrossGeofences.Current.RegionStatusChanged += (sender, args) => 
{
    args.State // entered or exited
    args.Region // Identifier & details
};

Stop monitoring a region

CrossGeofences.Current.StopMonitoring(GeofenceRegion);

or

CrossGeofences.Current.StopAllMonitoring();

FAQ