Geofence
Monitors circular geofences around latitude/longitude coordinates, and sends a notification to the user when the boundary of a geofence is crossed. Notifications can be sent when the user enters and/or exits a geofence. Geofences persist after device reboot. Geofences will be monitored even when the app is not running.
https://github.com/cowbell/cordova-plugin-geofence
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation#
- Capacitor
- Cordova
- Enterprise
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
#
Supported Platforms- Android
- iOS
- Windows
- Windows Phone 8
#
Usage#
ReactLearn more about using Ionic Native components in React
#
Angular#
Transition TypesTransition type specifies whether the geofence should trigger when the user enters and/or leaves the geofence.
#
Supported values- 1: Enter
- 2: Leave
- 3: Both
#
Defining a GeofenceGeofences are defined by an object that is passed to addOrUpdate()
. Object properties are:
- id: Any unique ID for the geofence. This ID is used to remove and update a geofence
- latitude: Latitude coordinate of the center of the geofence radius
- longitude: Latitude coordinate of the center of the geofence radius
- radius: Radius from the center to the edge of the geofence
- transitionType: Type of geofence transition to monitor for. See 'Transition Types' above
- notification: Object. Options for defining the notification sent when a geofence is crossed
- id: Any unique ID
- title: Notification title
- text: Notification body
- openAppOnClick: Boolean. Whether to open the app when the notification is tapped by the user
#
Troubleshootingionic build ios
or ionic run ios
.#
I get compile errors when I run This could be caused by the Cordova project directory in /platforms/ios
not being named correctly.
Try running ionic cordova platform rm <platform>
then run ionic cordova platform add <platform>
to recreate the
platform directories.