How to implement foreground service on android version less than android Oreo(O) using Kotlin
I am collecting raw sensor data (HeartRate, accelerometer, gyroscope, etc.) with Samsung Watch 4 which has Android version 6. I need to run my data collection application continuously in the background. However, it seems the watch OS kills the application after some time. So I need to implement a foreground service to keep the app running.
The problem is foreground services work above android version 8.
So my question is - How can I implement a foreground service on the android version 6...