Coder Social home page Coder Social logo

geofences's Introduction

ACR Geofence Plugin for Xamarin & Windows

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

PLATFORMS

Platform Version
Xamarin.iOS iOS 6+
Xamarin.Android API 10+
Windows 10 UWP 10+

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

  • Q) Why create another geofence plugin

    A) I felt like the integration or bloat in other geofence libraries (stay, notifications, etc). I also didn't like that Google Play Services were required in Android which required your device to be online when creating the geofences. This did not work with my requirements

  • Q) Why use a cross platform GPS library for Android?

    A) James has done a ton of work around the Android geolocation mess. I didn't want to duplicate this. I just wanted to attach to an event and set the desired accuracy

  • Q) Yes, but what about google play services?

    A) The amount of code necessary to register a geofence as well as all of the junk that came with it made it annoying and no less of a drain on the battery

geofences's People

Contributors

aritchie avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.