Question

I'm working on a Titanium mobile app, I'm using this geofencing module, and I'm trying to wrap my head around how to register a background service that can continue to receive geofence callbacks when the app is paused.

The problem I'm having is this:

If I try registering the geofence in a background service, I end up having two running instances of the module, both of which run geofence enter/exit callbacks (this happens each time I pause and resume the app, resulting in another region monitoring each time the app is either paused or resumed). If I don't register the geofence in the bg service, no callbacks run.

I tried referencing a global version of the module using something like:

ci_geofencing = Alloy.Globals.ci_geofencing

But it appears that the Alloy object isn't available to the background service.

Any suggestions for how this can be handled gracefully?

Was it helpful?

Solution

So it looks like I wasn't understanding the issue:

In ios, region monitoring doesn't require a background process. When a fence is triggered, the app is woken up to run the specified callback. So you don't actually have to do any background process setup to work with a geofence.

I'm still trying to wrap my head around how to manage instances of modules in Titanium, but regarding the background process/geofence issue, it's not something you have to worry about.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top