title: A broadcast receiver inside a service isnt working
body: <p>I have a receiver inside a service as i need the scheduled alarm to work even when the activity is destroyed. This is what i have done. </p>
  
  <pre><code>/**
   * Created by rishabh on 14/2/16.
   */
  public class MyService  extends Service {
  
  @Nullable
  @Override
  public IBinder onBind(Intent intent) {
      return null;
  }
  
  public class MyReceiver extends BroadcastReceiver{
  
      @Override
      public void onReceive(Context context, Intent intent) {
          Calendar c = Calendar.getInstance();
          int hour=c.get(Calendar.HOUR_OF_DAY);
          int minute=c.get(Calendar.MINUTE);
          Calendar calendar = new GregorianCalendar(1990, 1, 1, hour, minute);
          SimpleDateFormat sdf = new SimpleDateFormat("hh:mm");
          String date = sdf.format(calendar.getTime());
          String str=date.charAt(0)+""+date.charAt(1)+""+date.charAt(3)+""+date.charAt(4);
          String LOG_TAG="DevicePolicyAdmin";
          Log.v(LOG_TAG, "Service Started");
          MainActivity.minochaDevicePolicyManager.resetPassword(str, 0);
      }
  }
  }
  </code></pre>
  
  <p>And to trigger the receiver the scheduling alarm is here</p>
  
  <pre><code>    Intent intent3=new Intent(MainActivity.this,MyService.class);
      startService(intent3);
              Intent intent2 = new Intent(MainActivity.this, MyService.MyReceiver.class);
              PendingIntent pintent = PendingIntent.getService(MainActivity.this, 0, intent2, 0);
              AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
              alarm.setRepeating(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), 60 * 1000, pintent);
  </code></pre>
  
  <p>The onReceive method in the MyService class only executes once. why? What could be the issue. Please help</p>