如何使用基于coordova的Hybrid应用程序扫描附近所有的ibeacons? [英] How to scan all nearby ibeacons using coordova based Hybrid application?

查看:79
本文介绍了如何使用基于coordova的Hybrid应用程序扫描附近所有的ibeacons?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正计划开发一个混合应用程序,该应用程序将扫描ibeacons,您能否将我指向具有此功能的正确的cordova插件?

I am planning to develop a hybrid application that will scan ibeacons , can you please point me to right cordova plugin that has this facility?

我指的是 petermetz/cordova ,但似乎没有扫描工具

I was referring to petermetz/cordova, but it seems it doesn't have scan facility

我没有使用Angular JS,所以请不要参考ng插件

I am NOT using Angular JS, so please don't refer to ng plugins

谢谢

罗希特

推荐答案

是的, 可以使用cordova-plugin-ibeacon .它确实支持扫描信标,尽管示例并未说明这一点.请查看开始对单个iBeacon进行测距"示例.查找单个信标和大量信标之间的唯一区别是,将标识符设置为null可以将任何标识符作为通配符查找.像这样:

Yes, the cordova-plugin-ibeacon is the one to use. It does support scanning for beacons, although the examples don't make this obvious. Check out the "Start ranging a single iBeacon" example. The only difference between looking for a single beacon and lots of beacons is that you set the identifiers to null to look for any identifier as a wildcard. Like this:

var beaconRegion = new cordova.plugins.locationManager.BeaconRegion(identifier, uuid, null, null);

var beaconRegion = new cordova.plugins.locationManager.BeaconRegion(identifier, uuid, null, null);

上面的行将设置一个区域,可用于查找具有指定ProximityUUID的信标的任何主要和次要值.

The line above will set up a region that you can use to find any major and minor value for a beacon with the specified ProximityUUID.

这带来了Android和iOS之间的重要区别.在iOS上,您必须 提供一个ProximityUUID(显示的方法的第二个参数),并且无论ProximityUUID如何,都无法扫描所有信标.在Android上,您可以 为该参数提供null,从而有效地扫描任何信标.需要明确的是,这不是iOS上特定于插件的限制.这是操作系统的限制.

This brings up an important distinction between Android and iOS. On iOS, you must supply a ProximityUUID (the second parameter to the method shown) and it is impossible to scan for all beacons regardless of ProximityUUID. On Android, you can supply null for that parameter, effectively allowing you to scan for any beacon. To be clear, this is not a plugin-specific limitation on iOS. It is an operating system limitation.

这篇关于如何使用基于coordova的Hybrid应用程序扫描附近所有的ibeacons?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆