Please guide to a suitable architectural template that would do something like interrupts in the application for service events.
Task.
- Suppose I have sensors, and in the service I update them endlessly on request to the device.
- I need to be able at any time to request current sensor readings from the service.
- If I don’t even turn to the service, but it received data outside the safe range, the program should be interrupted anywhere and an error message and how to fix it are shown on the whole screen.
As it seems to me, I need my Service to be a “publisher”, and an Activity “subscribers” that have been assigned to the Sensor Event Listener. Or not? How beautiful to do it?