title: How to run a background service in Oreo for longer period?
body: <p>Android Oreo has imposed many restrictions on running background service. Services now don't behave like normal in Oreo as they used to before.</p>
  
  <p>But what if I have to run a service in background for long periods of time. </p>
  
  <p>I am developing an application to launch the flashlight when user shakes the phone. To achieve this I will have to put the Sensor listener code inside a service. </p>
  
  <p>How do I prevent android system to not kill the service.</p>
  
  <p>PS: I don't want to start a foreground service with a notification.</p>