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

Fixed scan filtering by name for API <21. #243

Merged
merged 3 commits into from Jul 7, 2017

Conversation

dariuszseweryn
Copy link
Owner

As it was observed for API <21 the name is not always available in the ScanRecord but it is available in the BluetoothDevice. On API >=21 this issue is not visible.

As it was observed for API <21 the name is not always available in the `ScanRecord` but it is available in the `BluetoothDevice`. On API >=21 this issue is not visible.
@dariuszseweryn dariuszseweryn added the bug Bug that is caused by the library label Jul 5, 2017
@dariuszseweryn dariuszseweryn added this to the 1.3.3 milestone Jul 5, 2017
@dariuszseweryn dariuszseweryn self-assigned this Jul 5, 2017
@dariuszseweryn dariuszseweryn requested a review from uKL July 5, 2017 13:55
return false;
if (mDeviceName != null) {
final boolean advertisedDeviceNameMatches = mDeviceName.equals(scanRecord.getDeviceName());
final boolean bluetoothDeviceNameMatches = mDeviceName.equals(device.getName());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small but pricy optimization. You can inline check from line 282 (and extract to a method) to avoid code execution when it's not required.

In this example the second check will be executed regardless the first one (even if deviceName matches).

@dariuszseweryn dariuszseweryn merged commit a65f71a into master Jul 7, 2017
@dariuszseweryn dariuszseweryn deleted the fix/scan_filter_name branch July 7, 2017 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is caused by the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants