-
Notifications
You must be signed in to change notification settings - Fork 3
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
How can I subscribe to a characteristic #1
Comments
I might be wrong, but I think this package only provides one time reading (not in stream, so there's no subscribe function). And to make it work on the background service, you need to use other packages. |
It will check automatically through this line "char.properties.notify == true". If selected characteristic has notified property, then it will subscribe to it and start getting values otherwise, it will only read one time and return the value. So, it depends upon the characteristic either it has notified property or not. |
I'm a bit confused by that to be honest. It returns a Future<String?> - which I would have assumed included the needed data. But given your comment I decided to go check the source code. The android project had basically no code. But checking the dart code better, I assume the functionality is done mostly through flutter packages.
Connect to device seems also seems to have some non-configurable android notification channel settings that should probably be configurable. Then, the lib/ble_background_service seems to have scanningMethod which when it finds a matching device will call "receiveCommandFromFirmware" which in turn - if it finds a matching characteristic will add to the strings log when the characteristic is written to. So that might work, particularly if there's a way to subscribe to a shared preffs string log (kind of annoying and potentially latent if we have to read it on loop). However, on iOS, it doesn't seem to do any notifiy check, it just calls some ios code which just calls read and returns a result. |
In summary, it seems like this plugin may not be fully fleshed for purposes like constantly staying connected and getting notified of it's events. And it may have some changes that are probably important for configuration (like the android service). |
I have a bluetooth bracelet and I want the app to receive a message and send a network request in time when the bracelet is tapped, but I don't see the ability to do so in the api
The text was updated successfully, but these errors were encountered: