# FlutterGeofencing
**Repository Path**: yjsf/FlutterGeofencing
## Basic Information
- **Project Name**: FlutterGeofencing
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: BSD-3-Clause
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-11-01
- **Last Updated**: 2021-11-01
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
**Author's Note:** this plugin is not officially supported and is meant to be used as an example. Please feel free to pull it into your own projects, but _there is no official version hosted on pub.dev and support may be limited_. If you run into any issues running this sample, please file an issue or, even better, submit a pull request!
What is geofencing?
[here](https://developer.android.com/training/location/geofencing)
# Geofencing
A sample geofencing plugin with background execution support for Flutter.
## Getting Started
This plugin works on both Android and iOS. Follow the instructions in the following sections for the
platforms which are to be targeted.
### Android
Add the following lines to your `AndroidManifest.xml` to register the background service for
geofencing:
```xml
```
Also request the correct permissions for geofencing:
```xml
```
Finally, create either `Application.kt` or `Application.java` in the same directory as `MainActivity`.
For `Application.kt`, use the following:
```kotlin
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate();
GeofencingService.setPluginRegistrant(this);
}
override fun registerWith(registry: PluginRegistry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
```
For `Application.java`, use the following:
```java
public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
GeofencingService.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
```
Which must also be referenced in `AndroidManifest.xml`:
```xml
NSLocationAlwaysAndWhenInUseUsageDescription
YOUR DESCRIPTION HERE
NSLocationWhenInUseUsageDescription
YOUR DESCRIPTION HERE
...
```
And request the correct permissions for geofencing:
```xml
...
Main
UIRequiredDeviceCapabilities
location-services
gps
armv7
UIBackgroundModes
location
...
```
### Need Help?
For help getting started with Flutter, view our online
[documentation](https://flutter.io/).
For help on editing plugin code, view the [documentation](https://flutter.io/developing-packages/#edit-plugin-package).