title: Make background service always run and never killself or system destroy it
body: <p>Hello I am running a background service to check in my server if there is a new data.</p>
  
  <p>But if I kill the App, the background service also dies.
  If I run the background service on it;s on process, the system kill it after it has run a couple times.</p>
  
  <p><strong>Manifest</strong></p>
  
  <pre><code>&lt;service
              android:name=".backgroundSerive"
              android:enabled="true"
              android:exported="false"/&gt;
  </code></pre>
  
  <p>Option 2</p>
  
  <pre><code>&lt;service
              android:name=".backgroundSerive"
  android:process=":my_process"
              android:enabled="true"
              android:exported="false"/&gt;
  </code></pre>
  
  <p><strong>MainAActivity - Starting the service</strong></p>
  
  <pre><code>Intent i = new Intent(this, backgroundSerive.class );
          i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          startService(i);
  </code></pre>
  
  <p><strong>Service</strong></p>
  
  <pre><code>    @Override
      public int onStartCommand(Intent intent, int flags, int startId) {
  ...start runnable
          return  START_STICKY; 
      }
  </code></pre>
  
  <blockquote>
    <blockquote>
      <p>I try both option, The service keeps getting killed. </p>
    </blockquote>
  </blockquote>
  
  <p>Any advice. To make my server always run.
  thank you</p>