11

I have an iPad app in the App Store whose logic relies largely on local notifications. In other words, much that happens inside the app is triggered by the delegate method application didReceiveLocalNotification.

With today's release of iOS 5, I see that apps can be placed (via Settings) either "In Notification Center" or "Not In Notification Center." I haven't found anything in the new documentation so far, but I'm hoping there is a way to have my app "In Notification Center" by default, (and possibly even set Sounds active and the notification type to Alert) which would save me having to explicitly explain to new users that after they download & install my app, they will have to manually go and elect for the app to be "In Notification Center."

Anyone know if this is possible? Seems that since an app can register a local notification, it should be able to receive it, by default (whether it displays an alert or an item in the new Notification Center, or not). Thanks in advance.

Gregir
  • 1,574
  • 5
  • 21
  • 43

2 Answers2

7

I've encountered the same problem. The only clue I saw in documentation is that the new Notification Center handles both local and remote notifications. Therefor I assumed that the app should register for local as it would for remote notification. Added this piece of code -

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

and after my app scheduled a local notification it appeared at the "In Notification Center".

BUT it seems to have no affect if my app already appears in "Not In Notification Center".. So have all of my customers that ran the app before the next update got screwed?

Kof
  • 23,893
  • 9
  • 56
  • 81
  • Well, that's somewhat helpful, at any rate. But yeah, I hate that people who have installed & run our apps previously just have to figure this out. I guess it's time to go put a message to iOS 5 upgrades on my support website and iTunes meta data! – Gregir Oct 14 '11 at 14:36
  • Mind if I ask where you added that code? Is there a best practice for that? Thanks again for the tip. – Gregir Oct 18 '11 at 15:54
  • I've added it right at the start of didFinishLaunchingWithOptions. This is really annoying by Apple, to have apps with only Local notifications to be turned off by default. What about the users that didn't update their apps from the App Store? – Kof Oct 19 '11 at 06:54
  • Seems to not work if you don't actually use push notifications, because the call otherwise fails? – mrueg Jan 12 '12 at 14:23
  • Not here, I don't use push and registration worked. Maybe you're using flags that require push? – Kof Jan 13 '12 at 03:48
3

Currently it seems not.

I'm in a similar situation. I'd love to be wrong about this but I've found no mention of any such API (for specifying that a local-notification using app should appear in notification center by default) in any of the places I'd expect it to be:

Jaysen Marais
  • 3,956
  • 28
  • 44
  • Me either, but I figured I'd put it out there, as I'm still relatively new to iOS and thought I could be missing it. – Gregir Oct 14 '11 at 14:35