{"action":"created","issue":{"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2282","repository_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push","labels_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2282/labels{/name}","comments_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2282/comments","events_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2282/events","html_url":"https://github.com/phonegap/phonegap-plugin-push/issues/2282","id":308258098,"number":2282,"title":"iOS badge not updated when app is in **foreground**","user":{"login":"peterlauri","id":3514945,"avatar_url":"https://avatars2.githubusercontent.com/u/3514945?v=4","gravatar_id":"","url":"https://api.github.com/users/peterlauri","html_url":"https://github.com/peterlauri","followers_url":"https://api.github.com/users/peterlauri/followers","following_url":"https://api.github.com/users/peterlauri/following{/other_user}","gists_url":"https://api.github.com/users/peterlauri/gists{/gist_id}","starred_url":"https://api.github.com/users/peterlauri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterlauri/subscriptions","organizations_url":"https://api.github.com/users/peterlauri/orgs","repos_url":"https://api.github.com/users/peterlauri/repos","events_url":"https://api.github.com/users/peterlauri/events{/privacy}","received_events_url":"https://api.github.com/users/peterlauri/received_events","type":"User","site_admin":false},"labels":[{"id":307723293,"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/labels/ios","name":"ios","color":"BFD4F2","default":false},{"id":196374009,"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-03-24T12:28:03Z","updated_at":"2018-03-26T09:55:50Z","closed_at":null,"author_association":"NONE","body":"### Expected Behaviour\r\n\r\nWhen application is in **foreground** and push with badge count only is received the badge icon should update.\r\n\r\n### Actual Behaviour\r\n\r\nWhen application is in **foreground** and push with badge count only is received the badge icon is not updated.\r\n\r\n### Reproduce Scenario (including but not limited to)\r\n\r\nApp in foreground\r\n\r\n#### Steps to Reproduce \r\n\r\nHave app in background, send push with badge=100, badge=100\r\nEnter app (foreground), send push with badge=10, put app in background... badge is 100, and not 10.\r\n\r\n#### Platform and Version (eg. Android 5.0 or iOS 9.2.1)\r\n\r\niOS=11.2.6\r\n\r\n#### (Android) What device vendor (e.g. Samsung, HTC, Sony...)\r\n\r\n#### Cordova CLI version and cordova platform version\r\n\r\n    cordova --version = 8.0.0\r\n    cordova platform version ios = 4.5.4\r\n\r\n#### Plugin version\r\n\r\n    cordova plugin version | grep phonegap-plugin-push\r\n\r\n   2.2.2\r\n\r\n#### Sample Push Data Payload\r\n\r\n#### Sample Code that illustrates the problem\r\n\r\n#### Logs taken while reproducing problem\r\n\r\n#### WORKAROUND with cordova-plugin-badge\r\n\r\n```\r\n          push.on('notification', (data) => {\r\n            // TODO: this is a workaround to update the badge when in foreground\r\n            if (data && data.additionalData && data.additionalData.foreground && data.count != undefined) {\r\n              cordova.plugins.notification.badge.set(data.count);\r\n            }\r\n          });\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/comments/376111766","html_url":"https://github.com/phonegap/phonegap-plugin-push/issues/2282#issuecomment-376111766","issue_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/2282","id":376111766,"user":{"login":"peterlauri","id":3514945,"avatar_url":"https://avatars2.githubusercontent.com/u/3514945?v=4","gravatar_id":"","url":"https://api.github.com/users/peterlauri","html_url":"https://github.com/peterlauri","followers_url":"https://api.github.com/users/peterlauri/followers","following_url":"https://api.github.com/users/peterlauri/following{/other_user}","gists_url":"https://api.github.com/users/peterlauri/gists{/gist_id}","starred_url":"https://api.github.com/users/peterlauri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterlauri/subscriptions","organizations_url":"https://api.github.com/users/peterlauri/orgs","repos_url":"https://api.github.com/users/peterlauri/repos","events_url":"https://api.github.com/users/peterlauri/events{/privacy}","received_events_url":"https://api.github.com/users/peterlauri/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T09:55:50Z","updated_at":"2018-03-26T09:55:50Z","author_association":"NONE","body":"@macdonst here you go. I removed some private information.\r\n\r\n```json\r\n{\r\n  \"android\": {\r\n    \"priority\": \"high\"\r\n  },\r\n  \"data\": {\r\n    \"somedatakey\": \"participant_read_message\"\r\n  },\r\n  \"notification\": {\r\n    \"badge\": 0\r\n  },\r\n  \"to\": \"XXX\"\r\n}\r\n```"}}
{"actor":{"display_login":"peterlauri"}}