title: android::Where to set alarm(in onCreate or not)
body: <p>I am setting alarm by following code</p>
  
  <pre><code>    AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
      Intent alarmReceiverIntent = new Intent(context, AlarmReceiver.class);
      PendingIntent alarmIntent = PendingIntent.getBroadcast(context, 0, alarmReceiverIntent, 0);
  
  
      Calendar calendar = Calendar.getInstance();
      calendar.setTimeInMillis(System.currentTimeMillis());
      calendar.set(Calendar.HOUR_OF_DAY, 14);
  
      alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
              AlarmManager.INTERVAL_DAY, alarmIntent);
  </code></pre>
  
  <p>Is it correct to put this code in onCreate? </p>
  
  <p>because, when i open my app again and again, the same code runs multiple time,Do the code overrides itself? or create multiple alarm specified time?</p>
  
  <p>Thanks.</p>