{ "id": "65708", "key": "TIMOB-4248", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-07-26T23:43:19.000+0000", "created": "2011-05-24T08:12:15.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "appBadge", "notification", "push" ], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-07-26T23:43:19.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h3. Description\n\nWhen I use '+2' in push notification (Apple), my app badge is correctly increased by 2 (for example, it it was at 0, it passes at 2).\n\nThen, I use\n{code:javascript}\nTi.UI.iPhone.appBadge = 0;\n{code}\n\nor\n\n{code:javascript}\nTi.UI.iPhone.appBadge = null;\n{code}\n\nand the badge correctly disappears.\n\nBUT, if I redo a '+2' push notification, the badge is now at 4!\n\n\n\nh3. How you can reproduce this issue:\n\nThere is a piece of code (which can be placed alone in app.js since it uses the function *Ti.Network.registerForPushNotifications*):\n\n{code:javascript}\n// Ask for APN registration\nTi.Network.registerForPushNotifications({\n\ttypes: [\n\t\tTi.Network.NOTIFICATION_TYPE_ALERT,\n\t\tTi.Network.NOTIFICATION_TYPE_BADGE,\n\t\tTi.Network.NOTIFICATION_TYPE_SOUND\n\t],\n\tsuccess: function(e) {\n\t\t// Send a request to urbanairship to register\n\t},\n\terror: function(e) {\n\t\tTi.API.warn('Push notifications disabled: ' + JSON.stringify(e));\n\t},\n\tcallback: function () {\n\t\t// Remove the badge on the main application icon\n\t\tTi.UI.iPhone.appBadge = 0;\n\t}\n});\n{code}\nNow, the different steps:\n\n. be sure that the current value of the app application icon badge is 0\n. with this code, subscribe to APN on an iPhone.\n. close your app (or put in in background)\n\n. send a notification with '+2' as badge value and 'hi' has text.\n. on your iPhone, when you receive the badge, open the app by accepting the notification\n. check the badge icon of your app, it should be '0' (because the code passe its value to '0': Ti.UI.iPhone.appBadge = 0; )\n\n. re-send the same notification\n. this time, don't accept the notification\n. check the badge icon of your app, it will get '4' as value in stead of '2'", "attachment": [], "flagged": false, "summary": "Issues with 'Ti.UI.iPhone.appBadge' ans push notifications as '+2'", "creator": { "name": "knice", "key": "knice", "displayName": "Romain", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "knice", "key": "knice", "displayName": "Romain", "active": true, "timeZone": "Europe/Berlin" }, "environment": ". build for iOS 4.1\n. sdk 4.3\n. on iPhone 4\n. Titanium 1.6.2", "comment": { "comments": [ { "id": "134434", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "In order for us to progress this issue, please edit your ticket to include a proper [Use-case|http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-CreatingGoodUsecases].\n\nAlso kindly read the [Submitting Bug Reports|http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-SubmittingBugReports] guide before raising tickets.\n\nThank you", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-05-30T03:10:59.000+0000", "updated": "2011-05-30T03:10:59.000+0000" }, { "id": "134436", "author": { "name": "knice", "key": "knice", "displayName": "Romain", "active": true, "timeZone": "Europe/Berlin" }, "body": "Sorry,\n\nThere is a piece of code:\n\n{code:javascript}\n// Ask for APN registration\nTi.Network.registerForPushNotifications({\n\ttypes: [\n\t\tTi.Network.NOTIFICATION_TYPE_ALERT,\n\t\tTi.Network.NOTIFICATION_TYPE_BADGE,\n\t\tTi.Network.NOTIFICATION_TYPE_SOUND\n\t],\n\tsuccess: function(e) {\n\t\t// Send a request to urbanairship to register\n\t},\n\terror: function(e) {\n\t\tTi.API.warn('Push notifications disabled: ' + JSON.stringify(e));\n\t},\n\tcallback: function () {\n\t\t// Remove the badge on the main application icon\n\t\tTi.UI.iPhone.appBadge = 0;\n\t}\n});\n{code}\n\nNow, the different steps:\n- be sure that the current value of the app application icon badge is 0\n- with this code, subscribe to APN on an iPhone.\n- close your app (or put in in background)\n\n- send a notification with '+2' as badge value and 'hi' has text.\n- on your iPhone, when you receive the badge, open the app by accepting the notification\n- check the badge icon of your app, it should be '0' (because the code passe its value to '0': Ti.UI.iPhone.appBadge = 0; )\n\n- re-send the same notification\n- this time, don't accept the notification\n- check the badge icon of your app, it will get '4' as value in stead of '2'\n", "updateAuthor": { "name": "knice", "key": "knice", "displayName": "Romain", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-05-30T03:33:22.000+0000", "updated": "2011-05-30T03:33:22.000+0000" }, { "id": "134445", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "This is good, Romain, but the script should run without modification when added to a blank app.js. Hence, where is the window created? You should include this, so that the core devs can replicate the behavior in the shortest time.\n\nAlso, are you able to modify/improve the actual ticket, rather than post comments?", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-05-30T05:34:58.000+0000", "updated": "2011-05-30T05:34:58.000+0000" }, { "id": "134465", "author": { "name": "knice", "key": "knice", "displayName": "Romain", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ticket updated, sorry for the inconvenience...", "updateAuthor": { "name": "knice", "key": "knice", "displayName": "Romain", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-05-30T10:55:18.000+0000", "updated": "2011-05-30T10:55:18.000+0000" }, { "id": "134467", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "No problem, Romain - thanks for bringing this to our attention. I've moved it to the appropriate project now.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-05-30T11:12:59.000+0000", "updated": "2011-05-30T11:12:59.000+0000" }, { "id": "216845", "author": { "name": "jonasfunk", "key": "jonasfunk", "displayName": "Jonas Funk Johannessen", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I dont think this is a Titanium issue. You will need to make a device registration call to reset the server-side counter when using the autobadge feature, as stated in this thread at Urban Airship: https://support.urbanairship.com/customer/portal/questions/369931-setbadgenumber-doesn-t-update-value-server-side.", "updateAuthor": { "name": "jonasfunk", "key": "jonasfunk", "displayName": "Jonas Funk Johannessen", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-29T11:48:18.000+0000", "updated": "2012-08-29T11:48:18.000+0000" }, { "id": "424858", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing due to inactivity. If this issue still exists, please raise a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-07-26T23:43:19.000+0000", "updated": "2017-07-26T23:43:19.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }