iphone - Update badge icon when app is closed -


i trying update badge icon app(closed) when received pn.

i have tried adding codes it's not working when app closed. works when app running in foreground.

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {        nsdictionary *remotenotif = [launchoptions objectforkey: uiapplicationlaunchoptionsremotenotificationkey];  //accept push notification when app not open     if (remotenotif) {       [application setapplicationiconbadgenumber:100];     return yes;     }  }     -(void) application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo     {              [[uiapplication sharedapplication] setapplicationiconbadgenumber: 30];      } 

if app closed or in background, push notification won't wake up. need server side , include number want see on icon in notification payload:

{     "aps" : {         "alert" : "your notification message",         "badge" : 1     } } 

have @ apple doc on push notification programming guide


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -