本文介绍了如何在Worklight中动态设置位置触发器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要为从Worklight适配器获得的每个位置动态创建新的地理围栏.我需要使用循环,因为我不知道后端服务中定义了多少个位置.此外,可以在应用程序运行时定义一个新位置.
I need to create new geofence circles dynamically for each location I get from a Worklight Adapter. I need to do it using a loop, as I dunno how many locations are defined in backend service. Furthermore a new location can be define meanwhile the application is running.
我已经看到了一组既定位置的示例,但是我不知道如何使其在我的场景中正常工作...
I have seen several samples for an established set of locations but I dunno how to get it working in my scenario...
推荐答案
我已经找到了解决方案.这是万一有人需要的代码:
I have already found a solution. This is the code in case someone needs it:
var triggers = new Object();
triggers.Geo={};
triggers.Geo.Cliente = {
type: "Enter",
circle: {
longitude: xxxxxx,
latitude: xxxxxxx,
radius: proximidad // 300m
},
confidenceLevel: "high", // ~95% confidence that we are in the circle
eventToTransmit: {
event: {
name: 'clientecerca'
},
transmitImmediately: true
}
};
这篇关于如何在Worklight中动态设置位置触发器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!