title: Xamarin.Android - Start service on Boot Completed
body: <p>I am trying to start a service when my device boots up, but the service never starts. </p>
  
  <p>I have added:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
  </code></pre>
  
  <p>to AndroidManifest.xml. My BroadcastReceiver looks like this:</p>
  
  <pre><code>[BroadcastReceiver]
  [IntentFilter(new[] { Intent.ActionBootCompleted })]
  public class BootReceiver : BroadcastReceiver
  {
      public override void OnReceive(Context context, Intent intent)
      {
          var start = new Intent(context, typeof(AlertSyncService));
          start.AddFlags(ActivityFlags.NewTask);
          context.StartService(start);
      }
  }
  </code></pre>
  
  <p>I have confirmed my service is not the issue (tested by starting the same service on button click - it works fine). The issue is definitely that the BroadcastReceiver is never receiving the event. I've also ensured that I open the app once before rebooting - I saw in a similar question that this is necessary, as apps are installed in a "stopped state". </p>
  
  <p>Does anybody have any ideas what could be causing this not to work? I'm relatively new to this, so highly likely I've missed something obvious!</p>
  
  <p>Thanks</p>