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
Set device name via advertisement records (on Android) #667
base: master
Are you sure you want to change the base?
Conversation
@BasuHuddar, could you please check if this behaves the same way as your original implementation (d452eea)? There is a nupkg built by the GHA CI that you can use: https://github.com/dotnet-bluetooth-le/dotnet-bluetooth-le/actions/runs/4637918781#artifacts What do you think about the |
@janusw getting error
published nuget package is not availble in https://api.nuget.org/v3-flatcontainer/plugin.ble/index.json { In the version list published nuget package is not available |
The nupkg built from this PR is not available on nuget.org, but you can just download it manually and use a local package source (in your case, copying it to |
@janusw It's not working |
Huh, any idea why? Could you do some debugging (maybe with the sample app)? (AFAICT my commit should more-or-less do the same as yours, but maybe it differs in some detail.) I tried the branch myself (with a Samsung Galaxy S21+ running Android 13), and I found some devices that advertise themselves with a |
@janusw Yes i added the committed code into the sample code base, but in the advertising flag, i dint find out the CompleteLocalName or a ShortLocalName in Android 13(Samsung M33 5G), but in Android 11(Samsung M40) able to find the CompleteLocalName or a ShortLocalName PFA |
Actually it should not be necessary to add any code manually (and it should be avoided for the sake of reproducibility). Instead you can simply build the sample client on my branch.
Hm, so either the difference is due to the different device and Android version, or there is a problem when parsing the advertisement records? As noted above, I see both *LocalName records on Android 13. It's still unclear to me why your branch works for you, but mine doesn't?!? |
@janusw For me im getting error in your branch(master), unable to build the solution for me. I am able to build 2.1.3 tag version, but not getting the completelocal name. Yeah, may be parsing is differing from one android mobile to another mobile. And i tested it by using the published nuget package (Plugin.BLE.3.0.0-beta.2-9-ge0b2bd8.nupkg), this is also not working. But this commit is working on my SamsungM33. |
So, if your commit above is working, but my PR here is not (and you don't even see a Since I have no way of reproducing the problem, I'm afraid you'll have to debug this on your own (or you tell me how to reproduce it). I guess the best setup for you to debug this is with the sample client on v2.1.3 (which should probably behave the same way as master in this respect). Try to step through Good luck (and please report any findings here)! |
Hi @janusw I created the new maui app and added the above local nuget package to test just the android names are visible or not then found Names are not visible can you help me what i'am missing ? |
Hi Samir,
you may not be missing anything. This PR was an attempt to fix the missing device names on Android, but @BasuHuddar already reported that it does not seem to help. It would be great if you could help to debug the problem. Under which conditions does it occur? Are you missing device names only for particular devices, or for all of them? Does it make a difference on which Android version it runs? Are you using a scan filter? |
Hi @janusw I tested in all the real android devices using my code it does not work. My Android Devices are VivoV15 pro, SamsungA51 which are on Android 10 and Android 12 running. |
Hm, what kind of filter did you try? The reason I was asking is because using a scan filter was the only condition under which I could reproduce the missing device names, see #660 (comment) |
e6bffb6
to
6c7e4ab
Compare
Please try that #660 (comment) |
This should fix #660 and #456. It is based on the idea (and initial implementation) of @BasuHuddar.
We check if the advertisment records, which are available for a specific device, contain a record of type
CompleteLocalName
. If yes, we use the corresponding data for setting the device name.While writing this, I wonder whether we should additionally make use of
ShortLocalName
(in caseCompleteLocalName
is not available) ...?