I have a Sticky Service that needs to be up all the time but doesn't restart itself when target SDK is 26. I did read the
thread on Android 8.0 but still have some doubt regarding this.
Firstly, here is what my app does:
- It runs a service that has a FileObserver monitoring a particular folder
- When a new file is created in this folder, FileObserver event is raised, upon which I do some modifications to the new file
- Then the file is moved to a different folder
To keep the above-mentioned service alive all the time, it is both sticky and set to start at boot. This has been working fine until I started targetting SDK 26. Now when the service gets killed, the system does not restart it anymore.
How can I make sure the system restarts the service when it is killed, just like how it used to behave when target SDK was below 26? Also is it possible to turn off via code, the persistent notification that is usually up when a service is running?