Easy Geofencing Is A Flutter Geofencing Package For Flutter Application (Android & Ios)
Easy Geofencing Is A Flutter Geofencing Package For Flutter Application (Android & Ios)
github.com /uzairleo/easy_geofencing
EASY GEOFENCING
1 de 7 31-01-2024, 19:37
Unknown Title about:blank
Easy Geofencing is a flutter geofencing package for flutter application (android & ios) which provides
geofencing functionalities.It is completely written in pure dart language.
FEATURES
2 de 7 31-01-2024, 19:37
Unknown Title about:blank
USAGE
3 de 7 31-01-2024, 19:37
Unknown Title about:blank
To add the easy_geofencing to your flutter application read the install instructions. Below are some Android
and iOS specifics that are required for the easy_geofencing to work correctly.
FOR ANDROID
AndroidX
The easy_geofencing plugin requires the AndroidX version of the Android Support Libraries. This means you
need to make sure your Android project supports AndroidX. Detailed instructions can be found here.
android.useAndroidX=true
android.enableJetifier=true
2. Make sure you set the compileSdkVersion in your "android/app/build.gradle" file to 30:
android {
compileSdkVersion 30
...
}
3. Make sure you replace all the android. dependencies to their AndroidX counterparts (a full list can be
found here: https://developer.android.com/jetpack/androidx/migrate).
Permissions
Starting from Android 10 you need to add the ACCESS_BACKGROUND_LOCATION permission (next to the
4 de 7 31-01-2024, 19:37
Unknown Title about:blank
FOR IOS
On iOS you'll need to add the following entries to your Info.plist file (located under ios/Runner) in order to
access the device's location. Simply open your Info.plist file and add the following:
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location when open.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This app needs access to location when in the background.</string>
If you would like to receive updates when your App is in the background, you'll also need to add the
Background Modes capability to your XCode project (Project > Signing and Capabilities > "+ Capability"
button) and select Location Updates. Be careful with this, you will need to explain in detail to Apple why your
App needs this when submitting your App to the AppStore. If Apple isn't satisfied with the explanation your
App will be rejected.
API
START EASY GEOFENCING SERVICES
At first you need to start the geofence service and for that you need to pass the following arguments:
import 'package:easy_geofencing/easy_geofencing.dart';
EasyGeofencing.startGeofenceService(
pointedLatitude: "34.2165157",
pointedLongitude: "71.9437819",
radiusMeter: "250.0",
eventPeriodInSeconds: 5
5 de 7 31-01-2024, 19:37
Unknown Title about:blank
);
To get the stream geofence Status updates on location changes, you need to subscribe
getGeofenceStream to listen geofence status streams on current location updates.
import 'package:easy_geofencing/easy_geofencing.dart';
StreamSubscription<GeofenceStatus> geofenceStatusStream =
EasyGeofencing.getGeofenceStream().listen(
(GeofenceStatus status) {
print(status.toString());
});
import 'package:easy_geofencing/easy_geofencing.dart';
EasyGeofencing.stopGeofenceService();
Also, stop GeofenceStatus stream subscription listener which is geofenceStatusStream in our case
geofenceStatusStream.cancel();
Issues
Please file any issues, bugs or feature requests as an issue on our GitHub page.
Dependencies
This plugin is depended on geolocator plugin of baseflow.com
Want to contribute
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a
6 de 7 31-01-2024, 19:37
Unknown Title about:blank
Author
This easy_geofencing plugin for Flutter is developed by uzairleo.
7 de 7 31-01-2024, 19:37