title: Android notification message at a particular time why it is repeated every time the app launched
body: <p>I would like to make the app send a notification at specific time of a day, I need to use alarm manger with notification as what described by this <a href="http://karanbalkar.com/2013/07/tutorial-41-using-alarmmanager-and-broadcastreceiver-in-android/" rel="nofollow">tutorial</a>. </p>
  
  <p>The code is working well, and send the notification at the specified time even if the app is not running however the notification is send also any time I run the app which is very weird.. below is the code, thanks for any hint. </p>
  
  <p>inside <code>onCreate()</code> in <code>MainActivity</code></p>
  
  <pre><code>Calendar calendar = Calendar.getInstance();
  
  calendar.set(Calendar.MONTH, Calendar.MAY);
  calendar.set(Calendar.YEAR, 2014);
  calendar.set(Calendar.DAY_OF_MONTH, 27);
  
  calendar.set(Calendar.HOUR_OF_DAY,10);
  calendar.set(Calendar.MINUTE, 33);
  calendar.set(Calendar.SECOND, 0);
  calendar.set(Calendar.AM_PM,Calendar.AM); 
  
  Intent myIntent = new Intent(this, MyReceiver.class);
  pendingIntent = PendingIntent.getBroadcast(this, 0, myIntent,0);
  
  AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
  alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
  </code></pre>
  
  <p><strong>MyReceiver.java</strong></p>
  
  <pre><code>public class MyReceiver extends BroadcastReceiver
  {
  
  @Override
  public void onReceive(Context context, Intent intent)
  {
     Intent service1 = new Intent(context, MyAlarmService.class);
     context.startService(service1);
  
  }
  
  }
  </code></pre>
  
  <p><strong>MyAlarmService</strong></p>
  
  <pre><code>public class MyAlarmService extends Service
  {
  
     private NotificationManager mManager;
  
      @Override
      public IBinder onBind(Intent arg0)
      {
         // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public void onCreate()
      {
         // TODO Auto-generated method stub 
         super.onCreate();
      }
  
     @SuppressWarnings({ "static-access"})
     @Override
     public void onStart(Intent intent, int startId)
     {
  
         mManager = (NotificationManager) getSystemService(getApplicationContext().NOTIFICATION_SERVICE);
         Intent intent1 = new Intent(this.getApplicationContext(),MainActivity.class);
  
  
  
  
         intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP| Intent.FLAG_ACTIVITY_CLEAR_TOP);
  
        PendingIntent pendingNotificationIntent = PendingIntent.getActivity( this.getApplicationContext(),0, intent1,PendingIntent.FLAG_ONE_SHOT);
  
        NotificationCompat.Builder mBuilder =
              new NotificationCompat.Builder(this)
              .setSmallIcon(R.drawable.ic_launcher)
              .setContentTitle("Today 27-5-2014")
              .setContentText(" You have your last final exam ")
              .setContentIntent(pendingNotificationIntent);
  
  
         mManager.notify(0, mBuilder.build());
  
  
      }
  
      @Override
      public void onDestroy()
      {
          // TODO Auto-generated method stub
          super.onDestroy();
      }
  
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> </p>
  
  <p>please note that my requirement is to send notification at particular time say At 10:00 Am.. 
  The code above succeed in sending the notification at 10:00 AM, 
  My problem is that the notification is still fired every time I run the app even if it is not 10:00 AM  </p>