Screen on/off broadcast listener for a widget on Android Oreo
I have a clock widget Android app which I am now trying to update to API 26 requirements. Up to now I used a background service which registered upon start in its onCreate method a BroadcastReceiver to receive system broadcasts, such as android.intent.action.SCREEN_ON, android.intent.action.SCREEN_OFF, android.intent.action.TIME_SET, android.intent.action.TIMEZONE_CHANGED . This service was then pausing the clock while screen is off and waking it up when screen is back on to save the battery. In Oreo a service of this kind does not seem to be an option, because it would have to run in the