Code Monkey home page Code Monkey logo

Comments (8)

philips77 avatar philips77 commented on June 11, 2024

nRF Connect is not using the scanner Compat Library. It actually allows you to switch between new and old scanning API in settings.
But in the app I'm not taking the name from BluetoothDevice, instead i parse the raw data. In the scanner library you may get the name from result.getRecord().getName(). Such name is parsed from the received data, not taken from phone's cache. The name in BluetoothDevice object gets overridden by value from Device Name characteristic after connection and may be cashed and not updated.

from android-scanner-compat-library.

maks-novikov avatar maks-novikov commented on June 11, 2024

This is very weird, i do tried to take the bytes from scan record but only 0-30 indexes had a value the rest 31-63 was zeroes, and from debugging i saw that the name is sit in 31-42 indexes .

from android-scanner-compat-library.

philips77 avatar philips77 commented on June 11, 2024

The raw bytes contain both advertising data and scan response data, if such is present. Reach of them is 0-31 bytes going. The rest of the array indeed is filled with zeros. Perhaps your phone indirectly puts scan response to the raw data and then fails to parse it?

from android-scanner-compat-library.

maks-novikov avatar maks-novikov commented on June 11, 2024

I really don't know why this happens, because the bluetooth device for sure send the scan response (other phones can see it) , the real question is why the NrfConnect app do see 80% of our ble devices ( we develop smart locks with ble) , where i make the check i have about 200 - 400 ble devices, and my custom bytes parsing show that the are no name contained in the data.

from android-scanner-compat-library.

philips77 avatar philips77 commented on June 11, 2024

If you're parsing the raw data manually, did you check Shortened Local Name field? It also may contain the name.

from android-scanner-compat-library.

maks-novikov avatar maks-novikov commented on June 11, 2024

I checked, the short name not included in the data.

from android-scanner-compat-library.

khan-07 avatar khan-07 commented on June 11, 2024

Hi,

I am facing the same problem . I can not get names from either getDevice() or getScanRecord(). I am working on android 9 as well. I get null for 99% of the times but sometimes i get a device name. While the NRF connect app shows those devices with names.

from android-scanner-compat-library.

maks-novikov avatar maks-novikov commented on June 11, 2024

Hi, @khan-07 i think i found the root cause for this problem and even the solution (not tried yet)
Look at the last answer here

from android-scanner-compat-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.