Search code examples
androidbluetooth-lowenergyforeground-service

Bluetooth connection in foreground service


I am developing an Android app for connecting to a Bluetooth device with callbacks for button presses. I want to add a foreground service that implements Bluetooth connectivity and gatt connection as well as having the bottom presses.

And all this should happen even if the app is killed or closed.

Edit: The question was a bit vague and not showing my efforts to solve it on my own. But as of 2 years now, it was already completed and accepted an answer from below


Solution