本文整理汇总了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);
}
}
});
}
示例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();
}
示例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"));
}
}
示例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);
}
});
}
示例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)));
}
示例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);
}
}
示例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);
}
}
}
示例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));
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
});
}
示例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);
}
});
}
示例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);
}
示例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();
}
}