title: Keep a Service Alive in Android 7.1.1 with OxygenOS 4.1.6
body: <p>Hi I want to  keep a service alive 
  This is my service code</p>
  
  <pre><code>public class  Myservice1 extends Service{
  
  @Override
  public int onStartCommand(Intent intent,int flags,int startdid){
  Toast.makeText(getApplicationContext(),"works",Toast.LENGHT_LONG).show();
  return START_STICKY;
  }
  }
  </code></pre>
  
  <p>and this is my manifest file</p>
  
  <pre><code>&lt;service
              android:name=".MyService1"
              android:enabled="true"
  
              /&gt;
  </code></pre>
  
  <p>This runs perfectly in android 7.0
  But when I run it in android 7.1.1 with OxygenOS 4.1.6 in one plus 3T the service gets killed after app is closed from recent apps but the services from other apps like whatsapp and truecaller runs perfectly.</p>