当前位置: 首页>>代码示例>>Java>>正文


Java Region类代码示例

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


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

示例1: scan

import com.estimote.sdk.Region; //导入依赖的package包/类
public void scan(){
    beaconManager = new BeaconManager(c);
    //final RefreshingDialog dialog = new RefreshingDialog(c);
    //dialog.createRefreshingDialog();
    startScanning();

    beaconManager.setRangingListener(new BeaconManager.RangingListener() {
        @Override
        public void onBeaconsDiscovered(Region region, List<Beacon> list) {
            for(Beacon b : list){
                addBeacon(b);
            }
        }
    });

}
 
开发者ID:donniepropst,项目名称:note.cntxt,代码行数:17,代码来源:BeaconDetailsDetector.java

示例2: startBeaconSearch

import com.estimote.sdk.Region; //导入依赖的package包/类
@ReactMethod
public void startBeaconSearch(ReadableMap map) {
    final Region region = convertMapToBeaconRegion(map);
    //set the foreground scan period
    beaconManager.setForegroundScanPeriod(5000, 5000);

    if (!isConnected) {
        //connect to BeaconService
        connectToBeaconService();
    }

    //start native ranging
    beaconManager.startRanging(region);

    //set the RangingListener
    setRangingListener();

    //set the StatusListener
    setScanStatusListener();

}
 
开发者ID:ti8m,项目名称:react-native-ibeacon-android,代码行数:22,代码来源:RNBeacon.java

示例3: convertMapToBeaconRegion

import com.estimote.sdk.Region; //导入依赖的package包/类
private Region convertMapToBeaconRegion(ReadableMap map) {
    if (!map.hasKey("minor")) {
        if (!map.hasKey("major")) {
            return createBeaconRegion(
                    map.getString("identifier"),
                    map.getString("uuid"),
                    null,
                    null);
        } else {
            return createBeaconRegion(
                    map.getString("identifier"),
                    map.getString("uuid"),
                    map.getInt("major"),
                    null);
        }
    } else {
        return createBeaconRegion(
                map.getString("identifier"),
                map.getString("uuid"),
                map.getInt("major"),
                map.getInt("minor"));
    }
}
 
开发者ID:ti8m,项目名称:react-native-ibeacon-android,代码行数:24,代码来源:RNBeacon.java

示例4: PiggateEstimoteBridge

import com.estimote.sdk.Region; //导入依赖的package包/类
public PiggateEstimoteBridge(Piggate piggate){
    _piggate=piggate;
    String UUID=Piggate.getMetadata(piggate.getApplicationContext(), "com.piggate.sdk.ApplicationUUID"); //Set the UUID
    _region = new Region(piggate.getApplicationContext().getPackageName()+"-"+UUID, UUID, null, null); //Set the region
    _beaconManager = new BeaconManager(piggate.getApplicationContext()); //Set the beacon manager
    _beaconManager.setRangingListener(new BeaconManager.RangingListener() { //Set the ranging listener
        //Handles the actions when the beacon are discovered
        //Put the beacons into a list and send them into the piggatecallback object
        @Override
        synchronized public void onBeaconsDiscovered(Region region, List<Beacon> beacons) {
            final ArrayList<PiggateBeacon> listBeacon=new ArrayList<PiggateBeacon>();
            final ArrayList<PiggateBeacon> listBeacon2;
            Beacon beacon;
            for(int x=0;x<beacons.size();x++){
                beacon=beacons.get(x);
                listBeacon.add(new PiggateBeacon(beacon.getProximityUUID(),beacon.getMacAddress(),beacon.getMajor(),beacon.getMinor(),beacon.getMeasuredPower(),beacon.getRssi()));
            }
            listBeacon2=PiggateBeacon.registryBeacon(listBeacon);
            if(listBeacon2.size()>0)
                _piggatecallback.GetNewBeacons(listBeacon2);
            PiggateBeacon.addPendingBeacons(listBeacon);
            _piggatecallback.GetBeacons(listBeacon);
        }
    });
}
 
开发者ID:piggate,项目名称:Piggate-Android-SDK,代码行数:26,代码来源:PiggateEstimoteBridge.java

示例5: initFromPreferences

import com.estimote.sdk.Region; //导入依赖的package包/类
private void initFromPreferences() {
    SharedPreferences prefs = PreferenceManager
            .getDefaultSharedPreferences(this);

    scanInterval = Integer.valueOf(prefs.getString(getString(R.string.pref_key_scan_interval), Defaults.SCAN_INTERVAL));
    scanPause = Integer.valueOf(prefs.getString(getString(R.string.pref_key_scan_pause), Defaults.SCAN_PAUSE));

    redRegion = new Region(RED, prefs.getString(getString(R.string.pref_key_red_uuid), Defaults.RED_UUID),
            Integer.valueOf(prefs.getString(getString(R.string.pref_key_red_major), Defaults.RED_MAJOR)),
            Integer.valueOf(prefs.getString(getString(R.string.pref_key_red_minor), Defaults.RED_MINOR)));

    greenRegion = new Region(GREEN, prefs.getString(getString(R.string.pref_key_green_uuid), Defaults.GREEN_UUID),
            Integer.valueOf(prefs.getString(getString(R.string.pref_key_green_major), Defaults.GREEN_MAJOR)),
            Integer.valueOf(prefs.getString(getString(R.string.pref_key_green_minor), Defaults.GREEN_MINOR)));

    blueRegion = new Region(BLUE, prefs.getString(getString(R.string.pref_key_blue_uuid), Defaults.BLUE_UUID),
            Integer.valueOf(prefs.getString(getString(R.string.pref_key_blue_major), Defaults.BLUE_MAJOR)),
            Integer.valueOf(prefs.getString(getString(R.string.pref_key_blue_minor), Defaults.BLUE_MINOR)));

}
 
开发者ID:wwerner,项目名称:Proximizer,代码行数:21,代码来源:Proximizer.java

示例6: onBeaconsDiscovered

import com.estimote.sdk.Region; //导入依赖的package包/类
/******** BeaconManager.RangingListener Implementation ********/

    @Override
    public void onBeaconsDiscovered(Region region, List<Beacon> list) {
        Timber.i("Beacons discovered in region %s are %d ", region.getIdentifier(), list.size());
        for (Beacon beacon : list) {
            Timber.i(beacon.toString());
        }
        Beacon nearestBeacon = calculateNearestBeacon(list);
        if (nearestBeacon == null) return;

        Timber.i("Nearest beacon is " + nearestBeacon);
        if (isSameAsTodayLatestEncounter(nearestBeacon)) {
            Timber.i("Skipping encounter. Beacon is same as today's latest successful encounter");
        } else {
            performEncounter(nearestBeacon);
        }
    }
 
开发者ID:ribot,项目名称:ribot-app-android,代码行数:19,代码来源:AutoCheckInService.java

示例7: onEnteredRegion

import com.estimote.sdk.Region; //导入依赖的package包/类
@Override
public void onEnteredRegion(Region region, List<Beacon> beacons)
{
    LogUtil.d("onEnteredRegion. Region entered: " + region.toString());

    for (Beacon beacon : beacons)
    {
        LogUtil.d(beacon.toString());

        if (beacon.getMajor() == MAJOR)
        {
            WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
            manager.setWifiEnabled(true);

            setScanningMode(ScanningModes.HOME_MODE);
        }
    }
}
 
开发者ID:zakaprov,项目名称:network-switcher,代码行数:19,代码来源:BeaconServiceReceiver.java

示例8: onBeaconsDiscovered

import com.estimote.sdk.Region; //导入依赖的package包/类
@Override
public void onBeaconsDiscovered(Region region, List<Beacon> list)
{
	dataReceived();

	for (Beacon beacon : list)
	{
		beaconDistances.put(getIdentifier(beacon), calculateDistance(beacon));
	}
}
 
开发者ID:hcmlab,项目名称:ssj,代码行数:11,代码来源:BeaconListener.java

示例9: startMonitoringForRegion

import com.estimote.sdk.Region; //导入依赖的package包/类
@ReactMethod
public void startMonitoringForRegion(ReadableMap map) {
    final Region region = convertMapToBeaconRegion(map);

    if (!isConnected) {
        //connect to BeaconService
        connectToBeaconService();
    }

    //start native monitoring
    beaconManager.startMonitoring(region);
}
 
开发者ID:ti8m,项目名称:react-native-ibeacon-android,代码行数:13,代码来源:RNBeacon.java

示例10: stopRangingForRegion

import com.estimote.sdk.Region; //导入依赖的package包/类
@ReactMethod
public void stopRangingForRegion(ReadableMap map) {
    final Region region = convertMapToBeaconRegion(map);
    //stop native ranging
    beaconManager.stopRanging(region);

}
 
开发者ID:ti8m,项目名称:react-native-ibeacon-android,代码行数:8,代码来源:RNBeacon.java

示例11: stopMonitoringForRegion

import com.estimote.sdk.Region; //导入依赖的package包/类
@ReactMethod
public void stopMonitoringForRegion(ReadableMap map) {
    final Region region = convertMapToBeaconRegion(map);
    //stop native monitoring
    beaconManager.stopMonitoring(region);

}
 
开发者ID:ti8m,项目名称:react-native-ibeacon-android,代码行数:8,代码来源:RNBeacon.java

示例12: setRangingListener

import com.estimote.sdk.Region; //导入依赖的package包/类
private void setRangingListener() {
    beaconManager.setRangingListener(new BeaconManager.RangingListener() {
        @Override
        public void onBeaconsDiscovered(Region region, final List<Beacon> beacons) {
            // Note that results are not delivered on UI thread.
            WritableMap params = Arguments.createMap();
            Log.v(BEACON, "Found amount: " + beacons.size());
            params.putString("beacons", new Gson().toJson(beacons));
            sendEvent(reactContext, "beaconsDidRange", params);
        }
    });
}
 
开发者ID:ti8m,项目名称:react-native-ibeacon-android,代码行数:13,代码来源:RNBeacon.java

示例13: NearestBeaconManager

import com.estimote.sdk.Region; //导入依赖的package包/类
public NearestBeaconManager(Context context, List<BeaconID> beaconIDs) {
    this.beaconIDs = beaconIDs;

    beaconManager = new BeaconManager(context);
    beaconManager.setRangingListener(new BeaconManager.RangingListener() {
        @Override
        public void onBeaconsDiscovered(Region region, List<Beacon> list) {
            checkForNearestBeacon(list);
        }
    });
}
 
开发者ID:rominirani,项目名称:Estimote-Slack,代码行数:12,代码来源:NearestBeaconManager.java

示例14: onEnteredRegion

import com.estimote.sdk.Region; //导入依赖的package包/类
/******** BeaconManager.MonitoringListener Implementation  ********/

    @Override
    public void onEnteredRegion(Region region, List<Beacon> list) {
        Timber.i("Entered region %s. Starting ranging...", region.getIdentifier());
        mBeaconManager.startRanging(region);
    }
 
开发者ID:ribot,项目名称:ribot-app-android,代码行数:8,代码来源:AutoCheckInService.java

示例15: onExitedRegion

import com.estimote.sdk.Region; //导入依赖的package包/类
@Override
public void onExitedRegion(Region region) {
    Timber.i("Exited region %s. Stopping ranging...", region.getIdentifier());
    mBeaconManager.stopRanging(region);

    RegisteredBeacon latestEncounterBeacon = getLatestEncounterBeacon();
    if (latestEncounterBeacon != null &&
            latestEncounterBeacon.uuid.equalsIgnoreCase(region.getProximityUUID().toString())) {
        performCheckOutLatestEncounter();
    }
}
 
开发者ID:ribot,项目名称:ribot-app-android,代码行数:12,代码来源:AutoCheckInService.java


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