question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Weird behavior on API >=23

See original GitHub issue

Summary


When scanning for devices I’m getting devices with the wrong mac address on API >=23

Preconditions


Use a API >=23 device

Steps to reproduce actual result

 fun scanAppliances(): Observable<Appliance> {
        return rxBleClient.scanBleDevices()
                .flatMap flatMap@ { scanResult ->
                    val uuids = AdvertisedServiceUUIDExtractor().extractUUIDs(scanResult.scanRecord)
                    val uuid = uuids.firstOrNull { servicesUUIDs.contains(it) } ?: return@flatMap null //this just filters out unwanted uuids
                    val bleDevice = scanResult.bleDevice
                    Timber.tag("scanAppliances")
                    Timber.d("--------------------------------------------------------\nnew scanResult")
                    Timber.d("device name: ${bleDevice.name} with macAddrs: ${bleDevice.macAddress} rssi: ${scanResult.rssi} UUID: $uuid")
                    val appliance = Appliance( //this is just my internal POJO
                            bleDevice.name,
                            uuid.toString(),
                            null,
                            bleDevice.macAddress
                    )
                    Timber.d("appliance created")
                    return@flatMap Observable.just(appliance)
                }
    }

Actual result


When scanning for devices on API 22 I only get one reading of each device, just like on this log:

screen shot 2017-05-11 at 20 15 28

This is what I’m expecting.

Expected result


When scanning on API 23 and API 25 devices, I get a endless stream of readings of the same device. The bigger problem is that sometimes the device appears with the wrong mac address. Using nF Connect app I can see that the wrong address actually are from another devices that are near screen shot 2017-05-11 at 20 09 01

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dariuszseweryncommented, May 12, 2017

As far as I know on Android 5.0+ the old API is using the new scan under the hood anyway but give it a try. I expect to have the new API scan implemented in the library somewhere next week. At least in the Snapshot.

0reactions
dariuszseweryncommented, May 15, 2017

Unfortunately it does not look like something that the library may fix if it works on another device properly. I cannot do more than suggest you to open an issue on Google’s issue tracker: https://issuetracker.google.com/issues?q=nexus 6p ble scan

Closing for now. If you will have more info or an idea what we could do from the library side - feel free to comment / reopen.

Best Regards

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Different selector behavior on API 21 and API 23
I am trying to implement a custom checkbox selector. After a couple of hours of trying to figure out what is wrong with...
Read more >
Weird behaviour with selection on Android #29780 - GitHub
Description After reseting the selection on a text input, the input keep reseting the selection to the value, which makes the cursor ...
Read more >
Behavior changes: all apps - Android Developers
The Android 12 platform includes behavior changes that may affect your app. The following behavior changes apply to all apps when they run...
Read more >
Splash Screen Icon Not Displaying on API 31 when starting ...
The icon shows on api 30 and lower (tested back to api 23) however no icon ... It's a weird, inconsistent behavior not...
Read more >
Let's use Android 12, Migration of our Android Apps to ...
“In this, I update one of my projects which was supporting Android11 (API 30) and was using a few third-party libraries I spent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found