Android-Scanner-Compat-Library icon indicating copy to clipboard operation
Android-Scanner-Compat-Library copied to clipboard

Set versionSdkInt

Open paulpv opened this issue 5 years ago • 2 comments

Before I found this [Android-Scanner-Compat-Library] library, I had rolled my own and allowed my code to set the version of the scanner it wanted to use. We could ask a user to change the version to something else, and sometimes that fixed things. Perhaps y'all would think this change is helpful too.

paulpv avatar Mar 14 '19 20:03 paulpv

That could easily cause a crash when you set too high SDK version. May I ask, what is the reason for this change? You want to use the older API despite having newer? Internally, in Android, the old, deprecated API is implemented using new one, if you look into it, so I see no reason why that could help.

philips77 avatar Mar 15 '19 08:03 philips77

Unless I am missing something, if sdk it set higher than Build.VERSION_CODES.O it will just use BluetoothLeScannerImplOreo. I used this in my private code originally developed in the Lollipop/Marshmallow days as an option to test compatibility problems, and figured it could be helpful in the future if there are other changes. I was not and am not aware of the underlying Android impl. If it really is moot to set the library to use API 18 on an API 28 device, then feel free to reject this PR...although in final defense, accepting this PR would facilitate providing empirical proof that the setting is moot, and without this ability it would be much harder to prove that the setting is moot. Feel free to reject, but I considered it a harmless addition.

paulpv avatar Mar 15 '19 20:03 paulpv