egmontr
egmontr

Reputation: 249

AltBeacon keeps scanning after stopping Bluetooth

I am devoloping an app which uses background scanning also. See Using AltBeacon: start and stop scanning from app settings

I have observed a strange behavior. When I am stopping the Bluetooth from the device settings, the app keeps scanning and calling didEnterRegion and didExitRegion. The Bluetooth symbol in the notification bar is gone. I can also see in logcat the D/BluetoothLeScanner: onScanResult() ... entrys.

How can this be?

Upvotes: 1

Views: 643

Answers (1)

davidgyoung
davidgyoung

Reputation: 64916

We have received a few other reports of this behavior on some devices. The exact cause is unknown, but I suspect that some devices are not accurately reflecting the Bluetooth status in the Android settings UI. It is possible that even when the user disables Bluetooth, if certain apps are already using it, then it remains on despite what the settings UI says.

EDIT: Based on the feedback in comments, it sounds like some Samsung S3 models preserve app-specific access to Bluetooth if it was enabled before or during the time the app was active. Even if you turn Bluetooth off in the system UI, it remains on for all running apps using it, despite what the UI says. Other apps launched after Bluetooth was turned off behave as though it is indeed off.

One way to confirm this would be to put your device into this state, then newly launch the Locate app for Android. This app will present the user with a dialog telling them to turn on Bluetooth if it is off on app launch. This test would give an independent confirmation of whether Bluetooth is really off regardless of what the settings UI is reporting.

In addition to commenting on the results of the above test, it would be very useful to know the device's Modelnumber, Android version, and Build number, all of which are available under Settings -> About Phone.

Full disclosure: I am lead developer on the Android Beacon Library project.

Upvotes: 2

Related Questions