title: What is the correct setting of BroadcastReceiver with BOOT_COMPLETED action in Xamarin project?
body: <p>I created a simple sample to test the <code>BroadcastReceiver</code> reacting to the action <code>BOOT_COMPLETED</code> see. below, but it is not working. After starting the tablet is no activity / app is running and in the logocat is nothing. I'm probably a mistake in the settings, but I can not find out what</p>
  
  <p>I use a tablet alps 874v3 android 4.4.2 and Visual Studio 2010 with Xamarin to write Android app in .net</p>
  
  <p>On SO I found some additional information:
  1 Registration <code>BroadcastReceiver</code> have not be inside AndroidManifest.xml but must use class attributes.
  2 Applications must contain <code>BroadcastReceiver</code>and <code>activity</code>  otherwise the  will not run on later versions of Android (for safety)
  3 Once installed the application is in stopped state so i started it (system verifies that the user wants the application) and then kill and then I try to reboot.</p>
  
  <pre><code>[BroadcastReceiver(Enabled = true, Exported = true, Permission = "RECEIVE_BOOT_COMPLETED")]
  [IntentFilter(new string[] { "android.intent.action.BOOT_COMPLETED"})]
  public class BootBroadcastReceiver : BroadcastReceiver
  {
      public BootBroadcastReceiver()
      {
      }
      public override void OnReceive(Context context, Intent intent)
      {
          Log.Debug("TestBoot", "BootBroadcastReceiver.OnReceive()");
          context.StartActivity(typeof(UsbMainActivity));
          Log.Debug("TestBoot", "BootBroadcastReceiver.OnReceive() after start activity");
      }
  }  
  
  [Activity(Label = "UsbMainActivity", Icon = "@drawable/icon", MainLauncher = true, Permission = "RECEIVE_BOOT_COMPLETED")]
  [IntentFilter(new string[] { "android.intent.action.BOOT_COMPLETED" })]
  public class UsbMainActivity : Activity
  {
      protected override void OnCreate(Bundle bundle)
      {
          base.OnCreate(bundle);
          SetContentView(Resource.Layout.Main);
          Utils.MyLog("TestBoot", 1, "UsbMainActivity.OnCreate()");
      }
  }
  </code></pre>
  
  <p>There is a AndroidMainfest.xml which was generated by xamarin : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="TestBoot.TestBoot" android:versionCode="1" android:versionName="1.0"&gt;
    &lt;uses-sdk android:minSdkVersion="15" android:targetSdkVersion="19" /&gt;
    &lt;application android:label="TestBoot" android:icon="@drawable/icon" android:name="mono.android.app.Application" android:debuggable="true"&gt;
      &lt;activity android:icon="@drawable/icon" android:label="UsbMainActivity" android:permission="RECEIVE_BOOT_COMPLETED" android:name="md5e98891b9b152ca725e5cab653b1387f3.UsbMainActivity"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MAIN" /&gt;
          &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
        &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;receiver android:enabled="true" android:exported="true" android:permission="RECEIVE_BOOT_COMPLETED" android:name="md5e98891b9b152ca725e5cab653b1387f3.BootBroadcastReceiver"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
        &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="2147483647" android:authorities="TestBoot.TestBoot.mono.MonoRuntimeProvider.__mono_init__" /&gt;
      &lt;receiver android:name="mono.android.Seppuku"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="mono.android.intent.action.SEPPUKU" /&gt;
          &lt;category android:name="mono.android.intent.category.SEPPUKU.TestBoot.TestBoot" /&gt;
        &lt;/intent-filter&gt;
      &lt;/receiver&gt;
    &lt;/application&gt;
    &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
    &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  &lt;/manifest&gt;
  </code></pre>