lulibrary / Background-Beacon-Monitoring

Cordova Plugin to allow background monitoring of beacons and sending interactions to Library Journeys server
Apache License 2.0
8 stars 10 forks source link

generic version #7

Open ddksaku opened 8 years ago

ddksaku commented 8 years ago

Hi, Do you have a plan to make the plugin generic which does not depend on the Library Journeys API? For example, BackgroundBeaconMonitoring.startService will have just two callback functions. Thanks.

stephenrob commented 8 years ago

Hi @ddksaku

At the minute there isn't plans to do this although it wouldn't be too hard to do. The difficult part is that any use of a 'generic' plugin would require some coding from the end user to implement the RangeNotifier and MonitorNotifier interfaces setting the actions to do when a beacon is ranged or entered/exited.

This is due to how the Android app lifecycle works and how background services work on Android. Once the user has quit the app the javascript callback's can't happen as the cordova layer doesn't exist anymore and therefore all actions to happen on the range and monitor events need to be implemented down in the service layer - this is a bit different to how it happens on iOS.

If you can suggest the best way to make a generic plugin / what you see it doing i'm more than happy to take suggestions for that and evaluate the feasibility of them.