Estimote / Android-Fleet-Management-SDK

Estimote Fleet Management SDK for Android
https://developer.estimote.com
MIT License
836 stars 451 forks source link

Shouldn't "beaconManager" be instance variable, not local function's variable? #39

Closed pbrewczynski closed 10 years ago

pbrewczynski commented 10 years ago

In your quick example you have:

 // Should be invoked in #onCreate.
BeaconManager beaconManager = new BeaconManager(context);
  beaconManager.setRangingListener(new BeaconManager.RangingListener() {
    @Override public void onBeaconsDiscovered(Region region, List<Beacon> beacons) {
      Log.d(TAG, "Ranged beacons: " + beacons);
    }
  });

Next part assume beaconManager is instance variable of that class, but it isn't.

  // Should be invoked in #onStart.
  beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
    @Override public void onServiceReady() {
      try {
        beaconManager.startRanging(ALL_ESTIMOTE_BEACONS);
      } catch (RemoteException e) {
        Log.e(TAG, "Cannot start ranging", e);
      }
    }
  });

Shouldn't beaconManager be instance variable ?

That is:

private BeaconManager beaconManager;
wiktor commented 10 years ago

Obviously yes.