0

How can I update my application badge every week in background mode.

I am working on a app for week numbers, and my application badge are then current week number, so I want it to updating every week by it self.

How can I do that, I have searched Google through, and I didn't find anything.

Maybe it is simple, but I have never worked in app delegate with all these methods, UILocalnotifications or an application badge.

Rajneesh071
  • 30,846
  • 15
  • 61
  • 74
Kasper Basse
  • 21
  • 1
  • 4

1 Answers1

0

You can use setApplicationIconBadgeNumber to set badge no.

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
Rajneesh071
  • 30,846
  • 15
  • 61
  • 74
  • yes i have it here: [[self.tabBarController.tabBar.items objectAtIndex:0] setBadgeValue:[NSString stringWithFormat:@"%i", intUgeNr]]; but i need it to updating by it self in background every week.. but i dont know how :( – Kasper Basse Sep 01 '12 at 13:36
  • sorry i send you the wrong one, that was for my badge in my app, here is for application icon badge: [[UIApplication sharedApplication] setApplicationIconBadgeNumber:intUgeNr]; sorry.. :) – Kasper Basse Sep 01 '12 at 13:37
  • are you setting local notification in every week...? – Rajneesh071 Sep 01 '12 at 13:43
  • nope, i only set [[UIApplication sharedApplication] setApplicationIconBadgeNumber:intUgeNr]; once i viewWillAppear when i open my app, but i want it to change every week i background, but i dont know how :) – Kasper Basse Sep 01 '12 at 13:46
  • so just fire a localNotification every week and in app delegate didReceiveLocalNotification method just write your code...[[UIApplication sharedApplication] setApplicationIconBadgeNumber:intUgeNr]; – Rajneesh071 Sep 01 '12 at 14:00
  • Okay I will try, I can not get one to send an even every week, by typing: `notification.fireDate = [NSDate date]; notification.repeatInterval = NSWeekCalendarUnit;` – Kasper Basse Sep 01 '12 at 14:18
  • you you can try,,..and for this repeateInterval i am doing R&D – Rajneesh071 Sep 01 '12 at 14:29