Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setApplicationBadgeIconNumber set in foreground status #680

Open
sathiyaraj45 opened this issue May 3, 2016 · 0 comments
Open

setApplicationBadgeIconNumber set in foreground status #680

sathiyaraj45 opened this issue May 3, 2016 · 0 comments

Comments

@sathiyaraj45
Copy link

Hi,
The following code i write to ios badge icon number set logic. while my app is active status meands badge icon number is set. When remove active status means not set badge icon number.

function onNotificationAPN (event) {
localStorage.setItem("push_id",event["url-args"]);

if ( event.alert ) {
    //navigator.notification.alert(event.alert);        
}
if ( event.sound )
{
    var snd = new Media(event.sound);
    snd.play();
}

if ( event.badge )
{
  //  alert('badge')
    var badgeNumber = Number(localStorage.getItem("badge")) + 1;
    localStorage.setItem("badge",badgeNumber)
    if(event.foreground == false) {
    window.plugins.pushNotification.setApplicationIconBadgeNumber(successHandler, errorHandler, badgeNumber);
    } else {
        window.plugins.pushNotification.setApplicationIconBadgeNumber(successHandler, errorHandler, badgeNumber);
    }
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant