0

I've been able to set an application badge number to my iPhone app and updating it once the user interacts with my app:

[[UIApplication sharedApplication ] setApplicationIconBadgeNumber:currNrOfNotif];

What I wont though, is for this process to occur while in background mode, ie from within applicationDidEnterBackground or similar. I would like this process to be scheduled to run daily, every night at 00:00 00:00 and take the current number in setApplicationIconBadgeNumber and decrement it by -1. No need for push notifications (or any server kind) in other words as the only thing that will happen is a change of the badge number value.

First of all, how do I schedule an activity to occur while app's in background mode, without using remote server push notifications?

Secondly, how do I get or fetch the current application notification badge value and decrement it by one?

In this post, some people argue it simply can't be done even with local notifications and that server side push's required. One person, however, states it can be done by scheduling it by midnight. Who's right, and can someone please propose a solution to this?

Community
  • 1
  • 1
Lindros
  • 253
  • 2
  • 12
  • The answer on that question that suggested this was possible in the way you describe is incorrect. The other two answers are pretty much your only option here. – Noah Witherspoon Jan 15 '13 at 21:14
  • are you sure, think I've seen it being described elsewhere too? – Lindros Jan 15 '13 at 21:56
  • The only cases in which your application can be running in the background are described in the multitasking programming guide: when it’s providing navigation, background audio, or VoIP, and for ~10 minutes after it goes to the background. None of those are suited to setting up this kind of scheduled task. I’d recommend using the local-notification approach. – Noah Witherspoon Jan 15 '13 at 22:07
  • Ok thanks. I guess I'll go for local notifications then. Could you please provide a sample code of how to do this and I'll gladly up your suggested answer and mark it as the correct one. – Lindros Jan 16 '13 at 23:39
  • possible duplicate of [iPhone: Incrementing the application badge through a local notification](http://stackoverflow.com/questions/5962054/iphone-incrementing-the-application-badge-through-a-local-notification) – Monolo Apr 06 '13 at 06:24

0 Answers0