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