Adds a geofence event-listener. Your supplied callback will be called when any monitored geofence crossing occurs. The `callbackFn` will be provided the following parameters:
Adds a geofence event-listener. Your supplied callback will be called when any monitored geofence crossing occurs. The `callbackFn` will be provided the following parameters:
######@param {Object} geofence. This object contains 2 keys: `@param {String} identifier` and `@param {String} action [ENTER|EXIT]`.
######@param {Object} params. This object contains 2 keys: `@param {String} identifier` and `@param {String} action [ENTER|EXIT]`.
######@param {Integer} taskId The background taskId which you must send back to the native plugin via `bgGeo.finish(taskId)` in order to signal that your callback is complete.
######@param {Integer} taskId The background taskId which you must send back to the native plugin via `bgGeo.finish(taskId)` in order to signal that your callback is complete.
```
```
bgGeo.onGeofence(function(params, taskId) {
bgGeo.onGeofence(function(params, taskId) {
try {
try {
console.log('A geofence has been entered: ' + identifier);
console.log('A geofence has been crossed: ', params.identifier);
console.log('ENTER or EXIT?: ', params.action);
} catch(e) {
} catch(e) {
console.error('An error occurred in my application code', e);
console.error('An error occurred in my application code', e);