Is the geofencing module broken on appcelerator? is there an alternative?

309 views Asked by At

I just upgraded to one of the premium memberships so that I could use the geofencing module. I'm having no luck at all, and there is no help from appcelerator.

Here is my simple, simple code:

var geoFences = e.geo_fences;
var regionList = [ ];
var region = Geofence.createRegion( {
  center: {
    latitude: 26,
    longitude: -98
  },
  radius: 400,
  identifier: 'test'
} );
regionList.push( region );

// There are multiple events tested here, because the sample code
// on appcelerators docs say "enterregion", but the list
// of events for the object says "enterregions"

Geofence.addEventListener( "enterregions", function( e ) {
  Ti.API.info('enter region fired');
});
Geofence.addEventListener( "enterregion", function( e ) {
  Ti.API.info('enter regions fired');
});
Geofence.addEventListener( "exitregion", function( e ) {
  Ti.API.info('exit region fired');
});
Geofence.addEventListener( "exitregions", function( e ) {
  Ti.API.info('exit regions fired');
});
Geofence.addEventListener( "error", function( e ) {
  Ti.API.info('error fired');
});
Geofence.addEventListener( "monitorregions", function( e ) {
  Ti.API.info('monitor regions fired');
});

// Start monitoring for region entrances/exits:
Geofence.startMonitoringForRegions( regionList );

I open the app in the iOS simulator, and i see: [INFO] : monitor regions fired

So it's monitoring the region. But i go to Debug > Location > Custom Location, and set it to 25, -98 (out of the region) then to 26, -98 (in the center of the region), then back to 25, -98, and I don't get any of the enter or exit regions firing!

I also tried this with a more precise location on an iphone 6+ with live cell and gps enabled. I drove from 1 mile away to the exact location, and it did not fire any of the events (400m is approx 1/4 mile)

I can't test it on android because there is a build error that i'm currently working on with appcelerator in jira.

Is the module broken? Is there an alternative module?

1

There are 1 answers

2
Ray On

I use the module myself, very successfully. So it does work.