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

Support for API level 21 (package android.bluetooth.le.*) #16

Closed
ecdpalma opened this issue Apr 25, 2016 · 8 comments
Closed

Support for API level 21 (package android.bluetooth.le.*) #16

ecdpalma opened this issue Apr 25, 2016 · 8 comments
Assignees
Milestone

Comments

@ecdpalma
Copy link

As BluetoothAdapter#startScan has been deprecated, it would be interesting to support the calls from the mentioned package, which allow more control over the scanning process.

As a temporary hack, I created (copy-pasted, in fact) a scan operation class that uses the new API. It can be found here. My idea is that the scan operation receives ScanFilter and ScanSettings and emits ScanResult. All these classes are from the android.bluetooth.le package.

@dariuszseweryn
Copy link
Owner

We are aware of the new scanning API. Thank you for showing your approach - we will check it.
Personally I was thinking about more universal approach in the API and just omit the settings that are unavailable on API < 21.

@uKL
Copy link
Collaborator

uKL commented Apr 25, 2016

Or maybe we could backport some of them... Worth considering.

@mzgreen
Copy link
Collaborator

mzgreen commented May 9, 2016

I agree, we could try to backport as much as we can but for now we should call new API methods on Lollipop and above and fallback to old one's on previous versions of Android.

@recoverrelax
Copy link

Yes Please support api 21+. The improvements on the api are so great, it will be a waste not to use the earlier APIs. I can tell you, devices >21, little to few able problems using the new API. The older API on the other hand ..

@dariuszseweryn dariuszseweryn modified the milestone: 1.1.0 Jul 27, 2016
@aldoborrero
Copy link

aldoborrero commented Aug 16, 2016

Why not to use the Android BLE Scanner Compat that NordicSemi has?

It allows you to abstract like the official android compat libraries does. The license is BSD clause 3 so it doesn't have to suppose a problem to use its codebase.

@cpboyd
Copy link

cpboyd commented Aug 25, 2016

I would at least be interested to invert the exclusivity of the service UUID filter, so that I could find different devices with specific UUIDs that are contained in the list.

e.g.:

    private boolean containsDesiredServiceIds(byte[] scanRecord) {
        List<UUID> advertisedUUIDs = uuidUtil.extractUUIDs(scanRecord);

        for (UUID desiredUUID : filterServiceUUIDs) {

            if (advertisedUUIDs.contains(desiredUUID)) {
                return true;
            }
        }

        return false;
    }

@bobroalexandr
Copy link

bobroalexandr commented Sep 23, 2016

@uKL @dariuszseweryn I've created pull request for ble scan v21 support #74. Please check if that's helpful for your project

@literator literator modified the milestones: 2.0.0, Android API 21 Compatibility, 1.2.0 Feb 2, 2017
@dariuszseweryn dariuszseweryn added this to the 1.3.0 milestone May 18, 2017
dariuszseweryn added a commit that referenced this issue May 22, 2017
Summary:
#16
#127

Reviewers: michal.zielinski, pawel.urban

Reviewed By: pawel.urban

Differential Revision: https://phabricator.polidea.com/D2279
@dariuszseweryn
Copy link
Owner

Just added the new scanning API to 1.3.0-SNAPSHOT. Feel free to check it out.

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

No branches or pull requests

9 participants