Search code examples
iphonecocoa-touchios4backgroundpush-notification

iPhone: How to set the application badge, when the app is closed/in background?


is it possible to set the application badge, while the app is in background mode or even closed? I haven't found anything, yet.

Application Badge


Solution

  • From within your application you can use the applicationIconBadgeNumber property of UIApplication to set the badge number:

    [UIApplication sharedApplication].applicationIconBadgeNumber = 1;
    

    If you want to change the badge without the user launching your app, you need to use the push notification service. The Push Notification Service Programming Guide should have all the info you need.