react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Geofence support for other moving objects

Open kkumaresan opened this issue 8 years ago • 6 comments

Our usecase is that, a large number of users need to track the position of a moving bus. Those users will be notified if the bus has reached near the location marked by them.

In summary, there are three personas here:

  • User (who is on mobile)
  • geo fence (could be a different location than user)
  • bus (whose location is fed into the context)

Scenarios:

  1. user is stationary and bus is moving
  2. user and bus are moving

We want to fire geo-fence (entry, exit) action when the bus hits the geo-fence set by the user rather than users current location. Could you please help on how we can go after the scenario? We understand when both user and bus are the same object, it can be easily handled.

kkumaresan avatar Feb 14 '18 04:02 kkumaresan

Is there an app on the Bus that you have control over (eg: able to send a Push request)?

christocracy avatar Feb 14 '18 04:02 christocracy

Yes, there is a device in the bus with the app that can trigger a push notification.

kkumaresan avatar Feb 14 '18 05:02 kkumaresan

So send a "silent" push request (ie: JSON payload only) to the bus with JSON of the geofence to add:

Capture this push on the Bus and interact with the plugin to add the geofence with supplied data, eg:

{
  "extra": {
    "command": "addGeofence",
    "params": {
      "latitude": 23.2342323,
      "longitude": 37.232323,
      "radius": 200,
      "identifier": "23dfasdf7qf987asd9f87asdfasd",
      "notifyOnEntry": true
    }
  }
}

christocracy avatar Feb 14 '18 06:02 christocracy

Or simply interrogate incoming locations from the bus at the server against geofences requested by the users (no need for device geofencing on the bus).

christocracy avatar Feb 14 '18 06:02 christocracy

Is there an option to send the geo location of bus to users and match fencing ? The user geo fence at this moment can't be sent to server or to the bus driver (privacy issues and we have to work with our customer to see if this is an option at all)

As such, bus location can be broadcasted, but users location or geo-fences have to live in their own device.

kkumaresan avatar Feb 14 '18 06:02 kkumaresan

Is there an option to send the geo location of bus to users and match fencin

It’s up to your server to send bus location to your own users.

Geofences are handled by the operating system, trigger by the location of the device monitoring them.

It is impossible to “simulate” a bus geofence on a user device.

You will have to perform geofencing on the server by analyzing incoming locations from bus, sending push requests to subscribed users.

christocracy avatar Feb 14 '18 07:02 christocracy