-
-
Notifications
You must be signed in to change notification settings - Fork 38
Begging you to provide a minimal working example source code #54
Comments
Hi Leo, I'll try and cover the points as best I can since I haven't touched the project I used this in in a while, so I might misremember some points. First point I'm not sure if it's possible to use this at all in expo, I originally enjoyed using expo as it was quick to test out packages, however, as you find quickly majority of packages (and production apps) use bare workflow so it's good to get to know it (assuming you don't/haven't used it) 2 & 3) these buttons are in there :)
My workaround was to convert the userId (or an identifying value name) into a uuid string with string-to-uuid then you can get the user details by matching the uuid that is scanned in the db
I'll have a look tomorrow at getting the example to work, you do have to run The other thing that may need to be updated is the gradle version but this is more of a maintenance than necessity as it should still work in its own project |
Oh, thanks for the quick reply.
Thanks so much, I will be super happy. (No need to hurry, I can wait many days/weeks). One more question: And here is one interesting video: Title: "React-Native with Expo and Bluetooth Low Energy for Beginners" But, anyway, as I said: I prefer Expo project but I also will be happy with bare workflow project. |
At least on Android it seems quite possible. For example, I tested this app and it works very well. It has broadcast and scan features. We can type custom text (up to probably 16 characters) and broadcast it and another phone scans/reads it quickly and pretty well. https://play.google.com/store/apps/details?id=net.alea.beaconsimulator https://github.com/vhiribarren/beacon-simulator-android Well, yeah, it's not a React Native project, but I guess we can do the same with RN. |
At the time I wrote this library (2020), I could not get Expo to work with Bluetooth at all. Even after ejecting it, Expo would interfere and make BLE debugging impossible to make sense of. The same was true for any emulator of a real phone. Maybe things have changed, but Bluetooth hardware is so messy that you might want to avoid any source of uncertainty in your dev environment. |
@leodevbro I've made this fork for the time being I stand corrected, it is possible to transmit data like a name however I'm not sure if this package was written with that in mind, its more just a broadcast and find. You're welcome to change it up and add that feature in but I don't think the strings will be able to be very long anyway. Perhaps ChatGPT can help and I might have a look in the far future but personally I don't have the need as the string I need is longer than 16 characters anyway. It should work between iOS to Android, and iOS to iOS, and Android to Android this was a feature I added for my use a while back. Most likely it will also work on Bluetooth 4 and 5, (I used a 5s for testing and it was fine) Check out the fork and don't forget to run |
@fhllnd, thanks so much. I'll try it.
Yeah, all I want is to just broadcast and find, nothing more. I was just thinking to create an app which would assign a unique id to each phone (saved in centralized backend database), and then the app would broadcast this id (from all phones) and these phones would discover each other (without pairing/connecting), so the owners of these phones will know that specific people are near them. So, I was thinking that some kind of id-like string would be a normal thing to identify phones. I don't need more than 16 characters. If not a string, then I don't know, some kind of binary number is considered to be an id? |
Yep that's exactly what I've used this for before. Say you have a users table with userId and broadcastId you can generate this using the uuid-by-string package and using the userId as the argument to make it unique and not random
And one step further to add a filter suffix this will allow you to use a query similar to One thing to note is this method relies on you knowing the userId, therefore the broadcastId field has to be populated after the user is created (two writes to db). You could do this with the email instead and then pass the broadcastId to the createUser method along with all the other user details which would remove this step and likely be just as safe with uniqueness I just didn't think of that at the time haha. Hopefully that makes sense :D |
@leodevbro you can now use the PR #55 in order to test, working on ios and android (you may have to change org in xcode) |
Hello, sorry for mass mentioning (tags), I really want to have an example code of this BLE advertiser package. I just could not setup it myself, I tried millions of times, but there are errors and errors and errors. I read many solved issues/conversations here, but still could not get it working.
@vitorpamplona, @ayoubphy, @JuliaGmP, @bentofortes, @pavankumarupai37, @hern12, @fhllnd, @Philip-Smyth,
Please, please provide a minimal working example source code of React Native project with this BLE package.
It can be super minimal.
I will be happy with anything, but, preferably:
1] to be Expo project.
2] to have "Broadcast" button which starts broadcasting simple string (up to 12 characters) like: "ThisIsLeo".
3] to have "Scan" button which starts scanning and shows list of scanned items: "ThisIsOlivia", "ThisIsBob", "ThisIsTom".
4] to be project with the latest React Native version.
5] to be omni-potent: I mean to work with any direction: Android/iPhone to Android/iPhone. Yeah, I understand the Bluetooth version should 5.0 or higher.
Initially, I thought Bluetooth broadcasting/scanning would be an easy thing, but now it's my big dream to somehow get it working and do some experiments with it.
The text was updated successfully, but these errors were encountered: