title: How do I set my service's priority to ensure that it starts at bootup?
body: <p>I'm trying to start my service at bootup, but I keep getting the <code>1245-1263/? I/ActivityManager﹕ Waited long enough for: ServiceRecord{3d8aa3b0 u9 myPackage/.myService}</code> exception.</p>
  
  <p>I've looked at this: <a href="https://stackoverflow.com/questions/21512469/my-service-always-getting-waited-long-enough-for-servicerecord-error-in-kitkat">My service always getting Waited long enough for: ServiceRecord error in Kitkat</a>
  which told me that the ActivityManager is putting starting my service on hold. I've confirmed through log statements that my receiver is indeed working. Here is the code in case anyone is interested:</p>
  
  <pre><code>public class PhoneStateReceiver extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context context, Intent intent) {
          Log.d("OnStartUp", "Service is about to be started");
          Intent myIntent = new Intent(context, myService.class);
          context.startService(myIntent);
      }
  }
  </code></pre>
  
  <p>So, how can I set my service's priority to "essential" so that Android makes sure it starts? I looked at this: <a href="https://stackoverflow.com/questions/27499431/how-to-set-the-priority-of-android-service">How to set the priority of android service?</a> but it deals with restarting a service rather than the initial startup.</p>
  
  <p>Here's the relevant bit of my manifest:</p>
  
  <pre><code>&lt;receiver android:name=".PhoneStateReceiver"
      android:enabled="true"
      android:label="PhoneStateReceiver"
      android:permission="android.permission.RECEIVE_BOOT_COMPLETED"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  &lt;service
      android:name=".myService"
      android:enabled="true"
      android:exported="true" &gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>