title: notification stopped when the device is rebooted in monodroid
body: <p>i'm trying to use notification in my application in monodroid
  the code that i wrote works well but when i reboot the device, the notification stopped and an alert pops up and says "Unfortunately app-name has stopped"
  i really don't know how to solve it. please help. thanks</p>
  
  <p><strong>main activity :</strong></p>
  
  <pre><code>Calendar calendar = Calendar.GetInstance(Java.Util.TimeZone.Default);
  
              calendar.Set(Calendar.Year, DateTime.Now.Year);
              calendar.Set(Calendar.Month, DateTime.Now.Month);
              calendar.Set(Calendar.DayOfYear, DateTime.Now.DayOfYear);
              calendar.Set(Calendar.HourOfDay,12);
              calendar.Set(Calendar.Minute, 00);
              calendar.Set(Calendar.Second, 00);
              calendar.Set(Calendar.Millisecond, 00);
  
              NotificationReceiver Notifications = new NotificationReceiver();
              Notifications.StartNotify(this, calendar.TimeInMillis);
  </code></pre>
  
  <p><strong>manifest.xml :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15" /&gt;
      &lt;!-- Permission to start Alarm on device reboot --&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
      &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
  
      &lt;application android:allowBackup="true" android:icon="@drawable/LogoLifeTime" android:label="@string/ApplicationName" android:theme="@style/AppTheme"&gt;
  
  
      &lt;activity android:name=".Main_Activity" android:label="@string/ApplicationName"&gt;&lt;/activity&gt;
  
      &lt;receiver android:name=".NotificationReceiver" android:enabled="true" android:exported="true"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
        &lt;/intent-filter&gt;
  
  
      &lt;!-- Will not be called unless the application explicitly enables it --&gt;
      &lt;receiver android:name=".DeviceBootReceiver" android:enabled="false"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
        &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>notificationreceiver :</strong></p>
  
  <pre><code>[BroadcastReceiver]
  [IntentFilter(new[] { Intent.ActionBootCompleted })]
        class NotificationReceiver : BroadcastReceiver
       {
           PowerManager.WakeLock w1;
  
            public override void OnReceive(Context context, Intent intent)
          {
                  PowerManager pm = (PowerManager)context.GetSystemService(Context.PowerService);
                  w1 = pm.NewWakeLock(WakeLockFlags.Partial, "NotificationReceiver");
                  w1.Acquire();
  
                  CreateNotification(context);
  
                  w1.Release();
  
          }
  
          void CreateNotification(Context context)
          {
              var nMgr = (NotificationManager)context.GetSystemService(Context.NotificationService);
              var notification = new Notification(Resource.Drawable.LogoLifeTime, "LTP");
  
              var pendingIntent = PendingIntent.GetActivity(context, 0, new Intent(context, typeof(check_daily_tasks_activity)), PendingIntentFlags.OneShot);
              notification.SetLatestEventInfo(context,"hello dear", pendingIntent);
              notification.Defaults |= NotificationDefaults.Sound | NotificationDefaults.Vibrate | NotificationDefaults.Lights;
              notification.Flags = NotificationFlags.ShowLights | NotificationFlags.AutoCancel;
              notification.LedARGB = Color.Blue;
              notification.LedOnMS = 1;
              notification.LedOffMS = 1;
              nMgr.Notify(0, notification);
  
          }
  
          public void StartNotify(Context context, long alertTime)
          {
              AlarmManager am = (AlarmManager)context.GetSystemService(Context.AlarmService);
              Intent intent = new Intent(context, this.Class);
              PendingIntent pi = PendingIntent.GetBroadcast(context, 0, intent, 0);
              am.SetRepeating(AlarmType.RtcWakeup, alertTime, AlarmManager.IntervalDay, pi);
  
          }
  
      }
  </code></pre>
  
  <p><strong>DeviceBootReceiver :</strong></p>
  
  <pre><code>[BroadcastReceiver]
      public class DeviceBootReceiver : BroadcastReceiver
      {
  
          public override void OnReceive(Context context, Intent intent)
          {
  
              if (intent.Action.Equals("android.intent.action.BOOT_COMPLETED"))
              {
                  Calendar calendar = Calendar.GetInstance(Java.Util.TimeZone.Default);
                  calendar.Set(Calendar.Year, DateTime.Now.Year);
                  calendar.Set(Calendar.Month, DateTime.Now.Month);
                  calendar.Set(Calendar.DayOfYear, DateTime.Now.DayOfYear);
                  calendar.Set(Calendar.HourOfDay, 12);
                  calendar.Set(Calendar.Minute, 00);
                  calendar.Set(Calendar.Second, 00);
                  calendar.Set(Calendar.Millisecond, 00);
  
                   NotificationReceiver Notifications = new NotificationReceiver();
                   Notifications.StartNotify(context, calendar.TimeInMillis);
  
                   Intent alarmIntent = new Intent(context, typeof(NotificationReceiver));
                   PendingIntent pendingIntent = PendingIntent.GetBroadcast(context, 0, alarmIntent, 0);
                   AlarmManager manager = (AlarmManager)context.GetSystemService(Context.AlarmService);
                   manager.SetInexactRepeating(AlarmType.RtcWakeup, calendar.TimeInMillis, AlarmManager.IntervalDay, pendingIntent);
                   Toast.MakeText(context, "Alarm Setsds", ToastLength.Short).Show();
  
              }
          }
  
      }
  </code></pre>