Unable to stop monitoring

I am able to startMonitoring for beacons with this line of code.

beaconManager.setBackgroundScanPeriod(TimeUnit.SECONDS.toMillis(1), 0);

		// Method called when a beacon gets...
		beaconManager.setMonitoringListener(new BeaconMonitorListener(context,beacon));

		// Connect to the beacon manager...
		beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
			@Override
			public void onServiceReady() {
				try {
					// ... and start the monitoring
					beaconManager.startMonitoring(ALL_ESTIMOTE_BEACONS);
				} catch (Exception e) {
				}
			}
		});

However, when I try to stopMonitoring I still get the beacons.

		beaconManager.stopMonitoring(ALL_ESTIMOTE_BEACONS);
		beaconManager.disconnect();

Am I missing something?

By any chance you were testing it on Moto G?

Nope, Im using Sony.

What exact device and OS version?

Xperia Z3, 5.1.1. I already found the problem. However, I found another issue regarding stopmonitoring. It stops monitoring all region even though I specified one region, it stops monitoring everything. Do you have any idea what the problem might be?

If you issues beaconManager.disconnect() it stops all monitoring. Also if you do beaconManager.stopMonitoring(ALL_ESTIMOTE_BEACONS); that will stop monitoring for all beacons.

But I change beaconManager.stopMonitoring(ONE_BEACON), it still stops monitoring everything. ONE_BEACON is a region specific to one of my beacon. So it should stop monitoring that particular beacon. However, in my case it stops monitoring everything.

1/ Can you turn on debug logging of the SDK with EstimoteSDK.enableDebugLogging(true)?
2/ Can you share the code for starting/stopping ranging along with definition of ONE_BEACON?
3/ Once you see that monitoring stopped unexpectedly can you dump logs from the device?

1 Like

Thanks for number 1. was able to find the problem. I was actually referring to the same beacon. So basically, the region definition was wrong. Thanks alot.