Urban Airship Reset Badge Api not reseting badge count

Hi,

Urban Airship Reset Badge Api not reseting badge count on applicationDidBecomeActive methods.Its working perfectly on didFinishLaunchingWithOptions.

I have a functionality in my app to reset badge count while user do Background/Foreground also when when user kill the app and relaunch So its working from didFinishLaunchingWithOptions but not working from applicationDidBecomeActive.

 

Please provide solution to my issue as i am stuck to complete this functionality.

 

Didn't find what you were looking for?

New post

Comments

9 comments

  • Hi Rahul,

    Can you let us know your code looks like for resetting the badge within your applicationdidBecomeActive method?

    0
  •  

     

     

     

    0
  • Hi Michael,

    Here is my code from  applicationDidBecomeActive 

    - (void)applicationDidBecomeActive:(UIApplication *)application {

    [[UAirship push] resetBadge];

    [[UAirship push]updateRegistration];

    }

    I have tried removing updateRegistration api and called only  resetBadge api.Also tried changing the sequence of resetBadge and updateRegistration api.

    0
  • Rahul,

    How are you determining that the resetBadge function is not working? If the app is open, the user doesn't see the badge count. It is not until the user backgrounds the app that they'll see the badge count.

    Could you describe what exactly isn't working?

    0
  • Hi Michael,

    I am showing the badge count on one of the tabs in my tab bar controller.Its kind of chat functionality that if user is not on that chatting tab while app is in foreground I am showing badge number that i receive from push notification to show x number of chat message sent to user.  

     

    0
  • and once user do background/foreground its a functionality to remove that badge count also if last time the badge count was 10 So after user did background/foreground than on new notification it should start from 1.

    0
  • Rahul,

    Resetting the badge only resets the badge count that appears outside the app on the app icon. It doesn't automatically affect any badging you're doing inside the app.

    So, when you can resetBadge inside the didBecomeActive method, you also have to update the badge count inside the app. The resetBadge method is not going to do that for you.

     

    0
  • Hi Michael,

    I know that resetBadge does not reset badge count on tab bar item on my app.My app requirement is when  user do background/foreground after that new push notification should be receive with a badge count of 1 instead of last badge count+1 (i.e. if last last badge count was 7 it should not be 8 after background/foreground and new notification received instead it should be 1).

    So at the last my problem is resetBadge does not reset badge count on UA Server. 

     

    0
  • Rahul,

    Do you know whether or not you've enabled autobadging in your app? This could cause some synchronization problems with the badge on the server vs. the client.

    Alternatively, does setting the badge manually, via 

    UAirship.push().setBadgeNumber(0)

    Work at all?

    0

Please sign in to leave a comment.