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

Compatibility issue when calling method #1119

Closed
PSDroid2022 opened this issue Aug 27, 2022 · 2 comments
Closed

Compatibility issue when calling method #1119

PSDroid2022 opened this issue Aug 27, 2022 · 2 comments

Comments

@PSDroid2022
Copy link

PSDroid2022 commented Aug 27, 2022

We confirm a compatibility issue which might threaten the robustness of your app and give a detailed suggestion for you.

In ''org.runnerup.hr.AndroidBLEHRProvider", you invoke the API "<android.bluetooth.BluetoothAdapter: void stopLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback)>" in "stopScan" method as shown in following. But actually, this API is introduced in API level 18(
https://developer.android.google.cn/reference/android/bluetooth/BluetoothAdapter?hl=en#stopLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback)).

  @Override
    public void stopScan() {
        if (mIsScanning) {
            mIsScanning = false;
            btAdapter.stopLeScan(mLeScanCallback);
        }
    }

So when the app try to invoke this API on devices after API level 16~17, your app will run with an unpredictable results. So we suggest you add an "if(SDK_INT >=18)" to fix this potential issue.

Android device

  • Device: [e.g. Emulator]
  • OS: [e.g. API 16~18]
  • Runnerup Version: [2.4.5.0]
@gerhardol
Copy link
Collaborator

ok

@gerhardol
Copy link
Collaborator

Sorry for not responding earlier: BLE was added in Android 4.3 (SDK 18), it should not be possible to start scanning with SDK below 18 anyway. There are about 17 users with this versions the last 28 days.

Note that the old BLE API is used that was replaced in Android 5/SDK21. That need to be replaced eventually should drop releases before 5.0 (another 12 user) or even 5.0 too (another 7).
Total 3362 users right now.

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