title: iOS Local Notification List After Notification has Fired
body: <p>My app runs in the background and watches for Bluetooth data. When data comes in I show a notification that the user needs to open the application so I can process the data that just came in.</p>
  
  <p>I am writing to iOS 5 and later.</p>
  
  <p>I make my notification using this code:</p>
  
  <pre><code>        UILocalNotification* alarm = [[[UILocalNotification alloc] init] autorelease];
          if (alarm) {
  
              alarm.fireDate = [NSDate date];
              alarm.timeZone = [NSTimeZone defaultTimeZone];
              alarm.repeatInterval = 0;
              alarm.soundName = @"alarmsound.caf";
              alarm.alertBody = message;
  
              [app scheduleLocalNotification:alarm];
          }
  </code></pre>
  
  <p>As I hope you can see from that code the notification fires right away.</p>
  
  <p>The problem I am having is that I can't seem to detect if there is already a notification on the notification bar. I have tried using:</p>
  
  <pre><code>        NSArray *oldNotifications = [app scheduledLocalNotifications];
  
          // Clear out the old notification before scheduling a new one.
          if ([oldNotifications count] &gt; 0)
              [app cancelAllLocalNotifications];
  </code></pre>
  
  <p>That doesn't seem to work, however, because oldNotifications count is always 0 even though there are a ton of them on the notification bar. I assume this is because the notifications have already fired?</p>
  
  <p>Basically I only want to notify the user once unless they dismiss that notification without opening the app. It would be nice if I could also increment the application badge value so the user would know how many bluetooth messages have come in. Instead I am just getting a whole new notification for each incoming message.</p>
  
  <p>How do I just notify the user once and then only notify them again if they have dismissed the notification?</p>