2

I'm looking for a way to update the badge count of iOS app icon from its iOS8 today extension. Today extension has a button and by touching that button, user can increase or decrease badge count of iOS app. Can anyone help me with this?

PS: I need to update the badge count without reopening the app even when the app is terminated.

ariane26
  • 163
  • 1
  • 6
  • 25
  • Not possible directly, though can be done using api, call api, and send Push Notification to app. – iphonic Mar 19 '15 at 08:08
  • orrr..use NSUserDefaults – soulshined Mar 19 '15 at 08:09
  • soulshined, how can i set badge count of app icon with NSUserDefaults? can you pls provide me snippet of code? – ariane26 Mar 19 '15 at 08:12
  • @soulshined But wouldn't using NSUSerDefaults still require the app to update the badge count? I can see your idea, update an int in the NSUserDefaults and then when the app is next open, have it check that value and update the app badge count accordingly, –  Mar 19 '15 at 08:13
  • i need to update the badge count without opening the app. – ariane26 Mar 19 '15 at 08:14
  • No @Dan you share it with an app group ...plenty of tutorials out there ariane26 - just use an embedded framework to share code : https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html – soulshined Mar 19 '15 at 08:16
  • @ariane26 You can see one of my answer here, there is a way by adding filewatcher, and update file.. see here http://stackoverflow.com/a/27796037/790842 – iphonic Mar 19 '15 at 08:17
  • @iphonic He want to know about Today Extension not watchppExtension.. – Dipen Chudasama Mar 19 '15 at 09:12
  • @DipenChudasama in all extension sharing of data works in same way. – iphonic Mar 19 '15 at 09:15

1 Answers1

0

As you already have created group, you can keep a file in the group folder and add a filewatcher in extension, update the file from app, and filewatcher will catch the change, and your work is done.

WebDev
  • 587
  • 1
  • 6
  • 23