Skip to content
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

BLE instance in service #38

Open
pawelkaczmarek12 opened this issue Jul 26, 2023 · 4 comments
Open

BLE instance in service #38

pawelkaczmarek12 opened this issue Jul 26, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@pawelkaczmarek12
Copy link

I wanted to use the library in Foreground Service, but at the moment it's not possible. Could you please add a context-only constructor?

@LeandroSQ LeandroSQ added the enhancement New feature or request label Jul 27, 2023
@LeandroSQ
Copy link
Owner

Hello, Thank you for your issue
It is theoretically possible, although I have never tested this on a Service, so it would need testing.

Would you be so kind to offer help to test the library given that I expose a new constructor for you?

@LeandroSQ LeandroSQ self-assigned this Sep 27, 2023
@LeandroSQ LeandroSQ reopened this Sep 27, 2023
@lemonjesus
Copy link

I'd be happy to play around with this - I have a need for BLE in a Foreground Service in a small project I'm working on and I'd love to use this library to make it happen!

@LeandroSQ
Copy link
Owner

Thank you for volunteering!
I will put out a prototype with this as soon as I get time to it, so we can get this into a new version.

@LeandroSQ
Copy link
Owner

Just updating this with my findings.

  1. We need special permission to handle connected devices on a foreground service
  2. Couldn't find a way to handle the jetpack contracts on the services, so it may be possible that using helpers like hardware availability, permission checking and so on wouldn't work
  3. It may be only possible to start the BLE instance on an Activity, Fragment or Jetpack compose activity, connect to a device and then pass the connection instance to the service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants