title: Stop a service at specific time
body: <p>I am starting my service using below code repeatedly. My service starts at 8am everyday. And AlarmManager repeates at every 1 min. I want to stop this sevice at 6pm. how can I do this ?</p>
  
  <pre><code>    AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
      PendingIntent loggerIntent = PendingIntent.getBroadcast(this, 0,new Intent(this,AlarmReceiver.class), 0);
  
      Calendar timeOff9 = Calendar.getInstance();
      timeOff9.set(Calendar.HOUR_OF_DAY, 08);
      timeOff9.set(Calendar.MINUTE, 00);
      timeOff9.set(Calendar.SECOND, 00);
      //--------------------------------------------------------------------------------------------------------------------
      long duration = userinterval * 60 * 1000;
      manager.setRepeating(AlarmManager.RTC_WAKEUP,timeOff9.getTimeInMillis(), duration, loggerIntent);
  </code></pre>