This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

show notification for Android nRF Blinky when running in background

I have modified Android_nRF_Blinky to show the status of a sensor along with a timer. I added an alarm notification to be popped up if the timer is overflowed and it is working properly. I made a Service and bound it to BlinkyActivity. I use this service to show notifications. But the problem is when the phone is locked or the app is not on the screen (like when you push home button) this notification doesn't appear. 

The previously established BLE connection is kept working when the app is running in the background. I know that my defined service is running in the background but it can't communicate with other parts of the app.

I have also found that the BLE manager app is working in the background but I couldn't bind my service to any running parts of app like BlinkyViewModel or BlinkManager. I put an if() in the onButtonStateChanged to check the received data and call the service method when it's needed but it causes a crash. So it means data is received and checked

Is there anyway to send the received data to the service? 

Related