I have an old application in which the service was invoked using the AlarmManager
's setExact
every minute, but in the latest Android O, it is not allowing me to run the service in the same way. I couldn't use foreground service because I don't want to show any notification when my service is running.
I want help on tweaking my application architecture in a way so that my code should run in the Android O with minimum changes.
When I run my application in the Android, it is crash:(.Please find the stack trace of the crash below.
java.lang.RuntimeException: Unable to create application com.***.***.***ControllerApplication: java.lang.IllegalStateException: Not allowed to start service Intent
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.***.***.qa/com.***.***.services.AlarmService
Edit:
The task in my application is time critical therefore I used setExact
in AlarmManager
but none of the currently supported APIs is scheduling jobs at an exact time. With that said, If I use JobScheduler/ WorkManager then my application will malfunction.