Cannot stop scanning for eddystone devices

Hi,

I’m using BeaconManager for eddystone scanning and it working fine. However when I want to stop and call disconnect and/or stopEddystoneScanning the logs show:

08-18 08:41:13.718  15718-15718/com.hotmob.app I/EstimoteSDK﹕ com.estimote.sdk.service.BeaconService.onDestroy:187 Service destroyed
08-18 08:41:13.721  15718-15718/com.hotmob.app D/BluetoothAdapter﹕ stopLeScan()
08-18 08:41:13.724  15718-15718/com.hotmob.app D/BluetoothAdapter﹕ scan not started yet
08-18 08:41:13.728  15718-19411/com.hotmob.app D/BluetoothAdapter﹕ startLeScan(): null
08-18 08:41:13.740  15718-15734/com.hotmob.app D/BluetoothLeScanner﹕ onClientRegistered() - status=0 clientIf=6
08-18 08:41:14.173  15718-15735/com.hotmob.app D/BluetoothLeScanner﹕ onScanResult() - ScanResult{mDevice=C9:C5:2E:58:18:92, mScanRecord=ScanRecord [mAdvertiseFlags=6, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -47, -60, 13, 27, -54, 74, 64, 1, -99, 108, -23, -7, 40, 33, -58, -86, 0, 1, 0, 1, -69]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-55, mTimestampNanos=1812255728327237}
08-18 08:41:14.174  15718-15735/com.hotmob.app D/BluetoothLeScanner﹕ onScanResult() - ScanResult{mDevice=C9:C5:2E:58:18:92, mScanRecord=ScanRecord [mAdvertiseFlags=6, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -47, -60, 13, 27, -54, 74, 64, 1, -99, 108, -23, -7, 40, 33, -58, -86, 0, 1, 0, 1, -69]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-55, mTimestampNanos=1812255728488851}
08-18 08:41:18.078  15718-15735/com.hotmob.app D/BluetoothLeScanner﹕ onScanResult() - ScanResult{mDevice=C9:C5:2E:58:18:92, mScanRecord=ScanRecord [mAdvertiseFlags=6, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -47, -60, 13, 27, -54, 74, 64, 1, -99, 108, -23, -7, 40, 33, -58, -86, 0, 1, 0, 1, -69]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-55, mTimestampNanos=1812259631364220}

And the onScanResult from BluetoothLeScanner continues ad infinitum. It wouldn’t be that bad except any subsequent scans give me empty list in onEddystonesFound. The scanner is run from WakefulBroadcastReceiver started by AlarmManager.
My device is Motorola Moto G with Android 5.0.2

Any advice?

Thanks!

Mind you sharing code that starts/stops scanning?

Sure.
The scanning is started like this (scala):

  val manager = new BeaconManager(context)
  // later in the same class ...
  def scanEstimote(listener: BeaconManager.EddystoneListener): Unit = {
    stop()
    manager.setEddystoneListener(listener)
    manager.connect(new ServiceReadyCallback {
      override def onServiceReady(): Unit = {
        scanId = manager.startEddystoneScanning()
      }
    })
  }
  def stop(): Unit = {
    manager.stopEddystoneScanning(scanId)
    manager.disconnect()
  }

This code is run from onReceive called by AlarmManager.setInexactRepeating:

val scanTime = intent.getLongExtra(ExtraScanTime, MinScanTime)
scanner.scanEstimote(new EddystoneListener {
        private val startTime = SystemClock.elapsedRealtime()

        override def onEddystonesFound(list: util.List[Eddystone]): Unit = {
          Log.d("BeaconScan", s"Found ${list.size()} eddystones: $list")
          if(SystemClock.elapsedRealtime() - startTime >= scanTime) {
            scanner.stop()
          }
        }
      })

It seems the problem with non-stop scanning is limited to moto g. My other devices work fine.

Interesting. Just today I was informed about one more case with moto g. I’ll keep an eye on moto g. Thanks!