My company is developing an app using the Estimote technology and we need to start scanning for beacons in background upon the system boot using a ProximityObserver created in a BroadcastReceiver in its onReceive(…) method using the withScannerInForegroundService(…) option.
This approach works well, however, we need to have an option to turn off the monitoring of beacons in the application. Normally, that would be done using the ProximityObserver.Handler calling its stop() method, however, in our case we have no way of holding the reference to this object as it is created in the BroadcastReceiver where the observation is started.
Is there any other way of how to turn the scanner off or the only way is to keep a reference to the ProximityObserver.Handler?
Thank you for your help.