Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntentScanningStrategy continues when the apk was updated to use ForegroundServiceScanning #1136

Open
jlasic opened this issue Mar 21, 2023 · 1 comment

Comments

@jlasic
Copy link

jlasic commented Mar 21, 2023

I stumbled on a bug when testing scanning strategies for our use-case. We had phones running the app for long periods of time and were connected to remote logging solution so we had the logs to be observed.

We tested IntentScanningStrategy first and then via an app updated switched the app to use ForegroundServiceScanning.

Expected behavior

After the update all IntentScanningStrategy broadcasts should stop, ie. app is unregistered from Android BluetoothLE pending intent callbacks

Actual behavior

Foreground service starts scanning, but the app is also receiving intents in StartupBroadcastReceiver#L37

Steps to reproduce this behavior

We used remote logging solution so I saw this behaviour on one of our phones, other 3 phones in the tests were not impacted, nor could I reproduce the issue on my local device.

What I observed from the sdk code is that in case of a process restart with a different scanning strategy ScanHelper#stopAndroidOBackgroundScan is never called since the sdk doesn't have any reference to previous intent scanning strategy startup, even when calling BeaconManager#setIntentScanningStrategyEnabled(false).

What I suggest is explicitly calling BluetoothLeScanner#stopScan(getScanCallbackIntent()) when client calls BeaconManager#setIntentScanningStrategyEnabled(false)

Mobile device model and OS version

Affected device in our tests: Galaxy S9 (SM-G960U1), Android 10

Android Beacon Library version

2.19.5-beta9

@davidgyoung
Copy link
Member

Thank you for this report. I know that boundary conditions associated with switching strategies is not well tested, so I believe you are probably correct here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants