我正在尝试编写一个与Android的Radius Networks iBeacon库交互的Cordova插件.现在,我知道这个库是为了与Activity/Service一起使用而设计的,但是在我的情况下它不会起作用,所以我试图尽可能地使用文档来调整它.目前,我只是试图让它倾倒掉它能看到的iBeacons的数量.
这是我的插件代码,为了简洁我省略了包/导入:
public class IBeaconPlugin extends CordovaPlugin implements IBeaconConsumer {
public static final String TAG = IBeaconPlugin.class.getName();
public static final String ACTION_FIND = "findBeacons";
private int count = -1;
public Context context;
private IBeaconManager iBeaconManager;
/**
* Constructor.
*/
public IBeaconPlugin() {
}
/**
* Sets the context of the Command. This can then be used to do things like
* get file paths associated with the Activity.
*
* @param cordova The context of the main Activity. …Run Code Online (Sandbox Code Playgroud)