• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IBeaconManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.radiusnetworks.ibeacon.IBeaconManager的典型用法代码示例。如果您正苦于以下问题:Java IBeaconManager类的具体用法?Java IBeaconManager怎么用?Java IBeaconManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IBeaconManager类属于com.radiusnetworks.ibeacon包,在下文中一共展示了IBeaconManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startRangingBeaconsInRegion

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
/**
 * methods for clients
 */

public void startRangingBeaconsInRegion(Region region, Callback callback) {
    synchronized (rangedRegionState) {
        if (rangedRegionState.containsKey(region)) {
            Log.i(TAG, "Already ranging that region -- will replace existing region.");
            rangedRegionState.remove(region); // need to remove it, otherwise the old object will be retained because they are .equal
        }
        rangedRegionState.put(region, new RangeState(callback));
    }
    if (IBeaconManager.debug)
        Log.d(TAG, "Currently ranging " + rangedRegionState.size() + " regions.");
    if (!scanningEnabled) {
        enableScanning();
    }
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:19,代码来源:IBeaconService.java


示例2: scheduleScanStop

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private void scheduleScanStop() {
    // Stops scanning after a pre-defined scan period.
    long millisecondsUntilStop = scanStopTime - (new Date().getTime());
    if (millisecondsUntilStop > 0) {
        if (IBeaconManager.debug)
            Log.d(TAG, "Waiting to stop scan for another " + millisecondsUntilStop + " milliseconds");
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                scheduleScanStop();
            }
        }, millisecondsUntilStop > 1000 ? 1000 : millisecondsUntilStop);
    } else {
        finishScanCycle();
    }


}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:19,代码来源:IBeaconService.java


示例3: getLeScanCallback

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
@TargetApi(18)
private Object getLeScanCallback() {
    if (leScanCallback == null) {
        leScanCallback =
                new BluetoothAdapter.LeScanCallback() {

                    @Override
                    public void onLeScan(final BluetoothDevice device, final int rssi,
                                         final byte[] scanRecord) {
                        if (IBeaconManager.debug) Log.d(TAG, "got record");
                        new ScanProcessor().execute(new ScanData(device, rssi, scanRecord));

                    }
                };
    }
    return leScanCallback;
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:18,代码来源:IBeaconService.java


示例4: calculateRunningAverage

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private double calculateRunningAverage() {
	refreshMeasurements();
	int size = measurements.size();
	int startIndex = 0;
	int endIndex = size -1;
	if (size > 2) {
		startIndex = size/10+1;
		endIndex = size-size/10-2;
	}

	int sum = 0;
	for (int i = startIndex; i <= endIndex; i++) {
		sum += measurements.get(i).rssi;
	}
	double runningAverage = sum/(endIndex-startIndex+1);

	if (IBeaconManager.debug) Log.d(TAG, "Running average rssi based on "+size+" measurements: "+runningAverage);
	return runningAverage;

}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:21,代码来源:RangedIBeacon.java


示例5: initialize

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);

    final Activity activity = cordova.getActivity();
    final YoikIBeacon that = this;

    this.lastNigh = new Time();
    this.lastNigh.setToNow();

    this.lastFar = new Time();
    this.lastFar.setToNow();
    this.firstNearFar = true;

    cordova.getThreadPool().execute(new Runnable() {
        @Override
        public void run() {

            iBeaconManager = IBeaconManager.getInstanceForApplication(activity);
            iBeaconManager.bind(that);
        }
    });
}
 
开发者ID:drivensystems,项目名称:cordova-yoik-ibeacon,代码行数:24,代码来源:YoikIBeacon.java


示例6: onCreate

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onCreate() {
    startHealthcheck();

    Set<BLEKitClient> runningClients = BeaconPreferences.getRunningClients(this);
    if( runningClients!=null ) {
        for( BLEKitClient client : runningClients ) {
            clients.put( client.getPackageName(), client );
        }
    }

    mMonitoredBeaconIds = BeaconPreferences.getMonitoredBeacons(this);

    L.d("added " + (runningClients != null ? runningClients.size() : 0) + " packages and " + mMonitoredBeaconIds.size() + " beacons");
    for( String id : mMonitoredBeaconIds.keySet() ) {
        L.d( id + " " + mMonitoredBeaconIds.get(id) );
    }

    iBeaconManager = IBeaconManager.getInstanceForApplication(this);
    iBeaconManager.bind(this);
}
 
开发者ID:upnext,项目名称:blekit-android,代码行数:25,代码来源:BLEKitService.java


示例7: writeToParcel

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
public void writeToParcel(Parcel out, int flags) {    
	if (IBeaconManager.debug) Log.d(TAG, "writing RangingData");
	out.writeParcelableArray(iBeaconDatas.toArray(new Parcelable[0]), flags);
	out.writeParcelable(regionData, flags);
	if (IBeaconManager.debug) Log.d(TAG, "done writing RangingData");

}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:8,代码来源:RangingData.java


示例8: RangingData

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private RangingData(Parcel in) {
	if (IBeaconManager.debug) Log.d(TAG, "parsing RangingData");
	Parcelable[] parcelables  = in.readParcelableArray(this.getClass().getClassLoader());
	iBeaconDatas = new ArrayList<IBeaconData>(parcelables.length);
	for (int i = 0; i < parcelables.length; i++) {
		iBeaconDatas.add((IBeaconData)parcelables[i]);
	}
	regionData = in.readParcelable(this.getClass().getClassLoader());
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:10,代码来源:RangingData.java


示例9: stopRangingBeaconsInRegion

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
public void stopRangingBeaconsInRegion(Region region) {
    synchronized (rangedRegionState) {
        rangedRegionState.remove(region);
    }
    if (IBeaconManager.debug)
        Log.d(TAG, "Currently ranging " + rangedRegionState.size() + " regions.");

    if (scanningEnabled && rangedRegionState.size() == 0 && monitoredRegionState.size() == 0) {
        disableScanning();
    }
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:12,代码来源:IBeaconService.java


示例10: startMonitoringBeaconsInRegion

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
public void startMonitoringBeaconsInRegion(Region region, Callback callback) {
    if (IBeaconManager.debug) Log.d(TAG, "startMonitoring called");
    synchronized (monitoredRegionState) {
        if (monitoredRegionState.containsKey(region)) {
            Log.i(TAG, "Already monitoring that region -- will replace existing region monitor.");
            monitoredRegionState.remove(region); // need to remove it, otherwise the old object will be retained because they are .equal
        }
        monitoredRegionState.put(region, new MonitorState(callback));
    }
    if (IBeaconManager.debug)
        Log.d(TAG, "Currently monitoring " + monitoredRegionState.size() + " regions.");
    if (!scanningEnabled) {
        enableScanning();
    }
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:16,代码来源:IBeaconService.java


示例11: stopMonitoringBeaconsInRegion

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
public void stopMonitoringBeaconsInRegion(Region region) {
    if (IBeaconManager.debug) Log.d(TAG, "stopMonitoring called");
    synchronized (monitoredRegionState) {
        monitoredRegionState.remove(region);
    }
    if (IBeaconManager.debug)
        Log.d(TAG, "Currently monitoring " + monitoredRegionState.size() + " regions.");
    if (scanningEnabled && rangedRegionState.size() == 0 && monitoredRegionState.size() == 0) {
        disableScanning();
    }
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:12,代码来源:IBeaconService.java


示例12: processRangeData

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private void processRangeData() {
     Iterator<Region> regionIterator = rangedRegionState.keySet().iterator();
     while (regionIterator.hasNext()) {
         Region region = regionIterator.next();
         RangeState rangeState = rangedRegionState.get(region);
         if (IBeaconManager.debug)
             Log.d(TAG, "Calling ranging callback with " + rangeState.getIBeacons().size() + " iBeacons");
         rangeState.getCallback().call(IBeaconService.this, "rangingData", new RangingData(rangeState.getIBeacons(), region));
         synchronized (rangeState) {
         	rangeState.clearIBeacons();
}
     }

 }
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:15,代码来源:IBeaconService.java


示例13: processExpiredMonitors

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private void processExpiredMonitors() {
    Iterator<Region> monitoredRegionIterator = monitoredRegionState.keySet().iterator();
    while (monitoredRegionIterator.hasNext()) {
        Region region = monitoredRegionIterator.next();
        MonitorState state = monitoredRegionState.get(region);
        if (state.isNewlyOutside()) {
            if (IBeaconManager.debug) Log.d(TAG, "found a monitor that expired: " + region);
            state.getCallback().call(IBeaconService.this, "monitoringData", new MonitoringData(state.isInside(), region));
        }
    }
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:12,代码来源:IBeaconService.java


示例14: matchingRegions

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private List<Region> matchingRegions(IBeacon iBeacon, Collection<Region> regions) {
    List<Region> matched = new ArrayList<Region>();
        Iterator<Region> regionIterator = regions.iterator();
        while (regionIterator.hasNext()) {
            Region region = regionIterator.next();
            if (region.matchesIBeacon(iBeacon)) {
                matched.add(region);
            } else {
                if (IBeaconManager.debug) Log.d(TAG, "This region does not match: " + region);
            }

        }

    return matched;
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:16,代码来源:IBeaconService.java


示例15: call

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
/**
 * Tries making the callback, first via messenger, then via intent
 * 
 * @param context
 * @param dataName
 * @param data
 * @return false if it callback cannot be made
 */
public boolean call(Context context, String dataName, Parcelable data) {
	if (intent != null) {
		if (IBeaconManager.debug) Log.d(TAG, "attempting callback via intent: "+intent.getComponent());
		intent.putExtra(dataName, data);
		context.startService(intent);		
		return true;			
	}
	return false;
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:18,代码来源:Callback.java


示例16: addRangeMeasurement

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
protected void addRangeMeasurement(Integer rssi) {
	this.rssi = rssi;
	addMeasurement(rssi);
	if (IBeaconManager.debug) Log.d(TAG, "calculating new range measurement with new rssi measurement:"+rssi);
	runningAverageRssi = calculateRunningAverage();
	accuracy = null; // force calculation of accuracy and proximity next time they are requested
	proximity = null;
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:9,代码来源:RangedIBeacon.java


示例17: addIBeacon

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
public void addIBeacon(IBeacon iBeacon) {
	if (rangedIBeacons.containsKey(iBeacon)) {
		RangedIBeacon rangedIBeacon = rangedIBeacons.get(iBeacon);
		if (IBeaconManager.debug) Log.d(TAG, "adding "+iBeacon.getProximityUuid()+" to existing range for: "+rangedIBeacon.getProximityUuid() );
		rangedIBeacon.addRangeMeasurement(iBeacon.getRssi());
	}
	else {
		if (IBeaconManager.debug) Log.d(TAG, "adding "+iBeacon.getProximityUuid()+" to new rangedIBeacon");
		rangedIBeacons.put(iBeacon, new RangedIBeacon(iBeacon));
	}
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:12,代码来源:RangingTracker.java


示例18: disableDebugNotifications

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private void disableDebugNotifications(CallbackContext callbackContext) {

		_handleCallSafely(callbackContext, new ILocationManagerCommand() {

			@Override
			public PluginResult run() {
				debugEnabled = false;
				IBeaconManager.setDebug(false);
				//android.bluetooth.BluetoothAdapter.DBG = false;
				return new PluginResult(PluginResult.Status.OK);
			}
    	});
	}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:14,代码来源:LocationManager.java


示例19: enableDebugNotifications

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private void enableDebugNotifications(CallbackContext callbackContext) {
	_handleCallSafely(callbackContext, new ILocationManagerCommand() {

		@Override
		public PluginResult run() {
			debugEnabled = true;
			//android.bluetooth.BluetoothAdapter.DBG = true;
			IBeaconManager.setDebug(true);
			return new PluginResult(PluginResult.Status.OK);
		}
   	});		
}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:13,代码来源:LocationManager.java


示例20: disableDebugLogs

import com.radiusnetworks.ibeacon.IBeaconManager; //导入依赖的package包/类
private void disableDebugLogs(CallbackContext callbackContext) {

		_handleCallSafely(callbackContext, new ILocationManagerCommand() {

			@Override
			public PluginResult run() {
				debugEnabled = false;
				IBeaconManager.setDebug(false);
				//android.bluetooth.BluetoothAdapter.DBG = false;
				return new PluginResult(PluginResult.Status.OK);
			}
    	});
	}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:14,代码来源:LocationManager.java



注:本文中的com.radiusnetworks.ibeacon.IBeaconManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsonValue类代码示例发布时间:2022-05-23
下一篇:
Java GenotypeType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap