I am using this code. Every thing is working fine when push notification comes but badge number does not increase when application is in background. How to solve this problem? <
You can't increase the badge number using code when app is in background or closed state.But the badge can be increased by value in notification payload.No code will execute during this state and Push notification is handled by OS itself. This link have the same issue and resolved.
Check whether the push notification payload contains application badge field and set to values greater than 0.If its 0,then badge number will be 0 when app in background or closed.