简体   繁体   English

appcelerator上的地理围栏模块是否损坏? 还有其他选择吗?

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

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. 我一点也没有运气,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 我在iOS模拟器中打开该应用,然后看到:[INFO]:触发了监视区域

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! 但是我去调试>位置>自定义位置,并将其设置为25,-98(在区域外),然后设置为26,-98(在区域的中心),然后又回到25,-98,然后我不要触发任何进入或退出区域!

I also tried this with a more precise location on an iphone 6+ with live cell and gps enabled. 我还在启用活细胞和GPS的iPhone 6+上的更精确位置上尝试了此操作。 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) 我从1英里外开车到确切的位置,但没有触发任何事件(400m约为1/4英里)

I can't test it on android because there is a build error that i'm currently working on with appcelerator in jira. 我无法在android上对其进行测试,因为我目前正在使用jira中的appcelerator处理构建错误。

Is the module broken? 模块坏了吗? Is there an alternative module? 有替代模块吗?

I use the module myself, very successfully. 我自己成功使用了该模块。 So it does work. 这样就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM