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


Java BeaconManager类代码示例

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


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

示例1: scan

import com.estimote.sdk.BeaconManager; //导入依赖的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: ApproachDetector

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
@SuppressWarnings("unused")
public ApproachDetector(IViewContext viewContext, double thresholdDistance, Context context) {
    super(viewContext);
    mThresholdDistance = thresholdDistance;

    mBeaconManager = new BeaconManager(context);
    mBeaconManager.setForegroundScanPeriod(SCAN_PERIOD_MILLIS, 0);
    mBeaconManager.setEddystoneListener(new BeaconManager.EddystoneListener() {
        @Override
        public void onEddystonesFound(List<Eddystone> list) {
            for (Eddystone e : list) {
                if (e.instance != null
                        && e.namespace != null
                        && e.instance.equals(EDDYSTONE_INS)
                        && e.namespace.equals(EDDYSTONE_NS)) {
                    handle(e);
                }
            }
        }
    });

    startScanning();
}
 
开发者ID:informatik-mannheim,项目名称:gesture-framework,代码行数:24,代码来源:ApproachDetector.java

示例3: PiggateEstimoteBridge

import com.estimote.sdk.BeaconManager; //导入依赖的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

示例4: connectToService

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
private void connectToService() {

        _piggatecallback.PreScanning();

        _beaconManager.connect(new BeaconManager.ServiceReadyCallback() {

            @Override
            public void onServiceReady() {
                if(_piggatecallback!=null)
                    _piggatecallback.onReady(); //if the service is ready call the onReady method of _piggatecallback
                try {
                    _beaconManager.startRanging(getRegion()); //Start ranging beacons
                } catch (RemoteException e) {
                    if(_piggatecallback!=null)
                        _piggatecallback.onErrorScanning(); //if there is an error call the onError method of _piggatecallback
                }
            }
        });
    }
 
开发者ID:piggate,项目名称:Piggate-Android-SDK,代码行数:20,代码来源:PiggateEstimoteBridge.java

示例5: setUpListeners

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
private void setUpListeners()
{
    btnToggleReceiver.setChecked(isReceiverEnabled());

    btnToggleReceiver.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
        {
            setReceiverState(isChecked);
        }
    });

    btnStop.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v)
        {
            BeaconManager manager = BeaconServiceReceiver.getBeaconManager(MainActivity.this);
            manager.disconnect();
        }
    });
}
 
开发者ID:zakaprov,项目名称:network-switcher,代码行数:22,代码来源:MainActivity.java

示例6: openConnection

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
private void openConnection()
{
    setScanningMode(ScanningModes.AWAY_MODE);

    beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady()
        {
            try
            {
                beaconManager.startMonitoring(ALL_ESTIMOTE_BEACONS);
            }
            catch (RemoteException e)
            {
                e.printStackTrace();
            }
        }
    });
}
 
开发者ID:zakaprov,项目名称:network-switcher,代码行数:20,代码来源:BeaconServiceReceiver.java

示例7: onStart

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
@Override
protected void onStart() {
  super.onStart();

  beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
    @Override
    public void onServiceReady() {
      try {
        beaconManager.startRanging(region);
      } catch (RemoteException e) {
        Toast.makeText(DistanceBeaconActivity.this, "Cannot start ranging, something terrible happened",
            Toast.LENGTH_LONG).show();
        Log.e(TAG, "Cannot start ranging", e);
      }
    }
  });
}
 
开发者ID:travelbird,项目名称:hackathon-estimote-demo,代码行数:18,代码来源:DistanceBeaconActivity.java

示例8: connectToService

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
private void connectToService() {
    getActionBar().setSubtitle("Scanning...");
    //clear values ...
    beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            try {
                beaconManager.startRanging(ALL_ESTIMOTE_BEACONS_REGION);
            } catch (RemoteException e) {
                Toast.makeText(WelcomeBird.this, "Cannot start ranging, something terrible happened",
                               Toast.LENGTH_LONG).show();
                Log.e(TAG, "Cannot start ranging", e);
            }
        }
    });
}
 
开发者ID:travelbird,项目名称:hackathon-estimote-demo,代码行数:17,代码来源:WelcomeBird.java

示例9: connectToService

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
private void connectToService() {
  getActionBar().setSubtitle("Scanning...");
  adapter.replaceWith(Collections.<Beacon>emptyList());
  beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
    @Override
    public void onServiceReady() {
      try {
        beaconManager.startRanging(ALL_ESTIMOTE_BEACONS_REGION);
      } catch (RemoteException e) {
        Toast.makeText(ListBeaconsActivity.this, "Cannot start ranging, something terrible happened",
            Toast.LENGTH_LONG).show();
        Log.e(TAG, "Cannot start ranging", e);
      }
    }
  });
}
 
开发者ID:travelbird,项目名称:hackathon-estimote-demo,代码行数:17,代码来源:ListBeaconsActivity.java

示例10: connectToService

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
private void connectToService() {
  getActionBar().setSubtitle("Scanning...");
  adapter.replaceWith(Collections.<Nearable>emptyList());

  beaconManager.setNearableListener(new BeaconManager.NearableListener() {
    @Override public void onNearablesDiscovered(List<Nearable> nearables) {
      getActionBar().setSubtitle("Found nearables: " + nearables.size());
      adapter.replaceWith(nearables);
    }
  });

  beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
    @Override
    public void onServiceReady() {
      beaconManager.startNearableDiscovery();
    }
  });
}
 
开发者ID:travelbird,项目名称:hackathon-estimote-demo,代码行数:19,代码来源:ListNearablesActivity.java

示例11: onResume

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
@Override
protected void onResume() {
  super.onResume();

  notificationManager.cancel(NOTIFICATION_ID);
  beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
    @Override
    public void onServiceReady() {
      try {
        beaconManager.startMonitoring(region);
      } catch (RemoteException e) {
        Log.d(TAG, "Error while starting monitoring");
      }
    }
  });
}
 
开发者ID:travelbird,项目名称:hackathon-estimote-demo,代码行数:17,代码来源:NotifyDemoActivity.java

示例12: onStartCommand

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    super.onStartCommand(intent, flags, startId);

    setNotification();

    mNotificationManager.cancel(WHOS_FANCY_NOTIFICATION_ID);
    mBeaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            try {
                mBeaconManager.startMonitoring(mRegion);
            } catch (RemoteException e) {
                Log.d(TAG, "Error while starting monitoring");
            }
        }
    });

    return START_STICKY;
}
 
开发者ID:FancyPixel,项目名称:whosfancy-android,代码行数:21,代码来源:MyService.java

示例13: initializeEstimote

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
/**
 * Initialize the Estimote Monitoring to check if a device enters the area of
 * a selected Beacon to notify the Harvest time tracking
 */
private void initializeEstimote() {

    // Initialize the Beacon manager
    mBeaconManager = new BeaconManager(this);
    mBeaconManager.setBackgroundScanPeriod(BEACON_SCAN_PERIOD, BEACON_WAIT_PERIOD);
    mBeaconManager.setRangingListener(this);

    // Connect to the Beacon Service
    mBeaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            try {
                mBeaconManager.startRanging(ALL_ESTIMOTE_BEACONS);

                Timber.i("Starting Ranging");
            } catch (RemoteException e) {
                Timber.d("Error while starting monitoring");
            }
        }
    });
}
 
开发者ID:hackathon-2014,项目名称:disciples-of-duarte-repo,代码行数:26,代码来源:BeaconService.java

示例14: connectToBeaconService

import com.estimote.sdk.BeaconManager; //导入依赖的package包/类
private void connectToBeaconService() {
    beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            Log.v(BEACON, "service is ready");
            isConnected = true;
        }
    });
}
 
开发者ID:ti8m,项目名称:react-native-ibeacon-android,代码行数:10,代码来源:RNBeacon.java

示例15: setRangingListener

import com.estimote.sdk.BeaconManager; //导入依赖的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


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