title: Unable to check if alarm has been set by AlarmManager
body: <p>I am checking if the alarm has already been set by the AlarmManager using <a href="https://stackoverflow.com/a/9575569/3739412">this answer</a>.</p>
  
  <p>Following is my code snippet.</p>
  
  <pre><code>boolean alarmUp = (PendingIntent.getBroadcast(MainActivity.this, 0,
      new Intent(MainActivity.this, AlarmReceiver.class), PendingIntent.FLAG_NO_CREATE) != null);
  if (alarmUp) {
      // alarm is set; do some stuff
  }
  
  Intent alarmIntent = new Intent(MainActivity.this, AlarmReceiver.class);
  final PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
  
  AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
  manager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 10 * 1000, pendingIntent);
  </code></pre>
  
  <p>However, <code>alarmUp</code> is always being set as true. That is, whether I set the alarm or not, whenever I restart my app, it tell me that <code>alarmUp</code> is true (I am checking it by making a <code>Toast</code>).</p>
  
  <p>Please help where I am going wrong.</p>