{ "id": "161501", "key": "TIMOB-23581", "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": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2016-08-08T16:23:30.000+0000", "created": "2016-06-30T21:14:07.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "iOS", "schedulelocalnotification" ], "versions": [ { "id": "17707", "name": "Release 5.3.0", "archived": false, "released": true, "releaseDate": "2016-06-04" } ], "issuelinks": [], "assignee": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-24T18:55:33.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": "h6.description\r\n\r\nSchedule Local Notification shows duplicate Notification for iOS but it works as expected on android. \r\n\r\nh6. Steps to reproduce\r\n1. Create a new project.\r\n2. Paste the code on app.js file\r\n3. Mention the time after 5 or any minutes and then install the app on the device.\r\n4. Beofre it reaches 5 minutes kill the app multiple times \r\n5. For Example: If I kill the app for 2 times, then it is displaying the notification two times.\r\n6. But it should only one.\r\n\r\nh6.Test Code\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\r\n});\r\n\r\nif (Ti.Platform.name == \"iPhone OS\" && parseInt(Ti.Platform.version.split(\".\")[0]) >= 8) {\r\n\tTi.App.iOS.registerUserNotificationSettings({\r\n\t\ttypes : [Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE]\r\n\t});\r\n\r\n\tvar notification = Ti.App.iOS.scheduleLocalNotification({\r\n\t\t// Alert will display 'slide to update' instead of 'slide to view'\r\n\t\t// or 'Update' instead of 'Open' in the alert dialog\r\n\t\talertAction : \"update\",\r\n\t\t// Alert will display the following message\r\n\t\talertBody : \"New content available! Update now?\",\r\n\t\t// The badge value in the icon will be changed to 1\r\n\t\tbadge : 1,\r\n\t\trepeat : 'daily',\r\n\t\t// Alert will be sent in three seconds\r\n\t\tdate : new Date(new Date().getTime() + 300000),\r\n\t\t// The following sound file will be played\r\n\r\n\t});\r\n}\r\n\r\n// Fired when the application receives an incoming local notification when it's in the foreground\r\n\r\nTi.App.iOS.addEventListener('notification', function(e) {\r\n\r\n\t// Reset the badge value\r\n\tif (e.badge > 0) {\r\n\t\tTi.App.iOS.scheduleLocalNotification({\r\n\t\t\tdate : new Date(new Date().getTime()),\r\n\t\t\tbadge : -1\r\n\t\t});\r\n\t}\r\n});\r\n\r\nwin.open();\r\n\r\n{code}\r\nThanks", "attachment": [], "flagged": false, "summary": "iOS: Schedule a Local Notification shows duplicate notification.", "creator": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": "Ti SDK: 5.3.0.GA, 5.2.2.GA\r\nCLI: 5.3.0\r\niOS Device: iPhone 5s v 9.3.2\r\n", "closedSprints": [ { "id": 685, "state": "closed", "name": "2016 Sprint 16 SDK", "startDate": "2016-07-30T00:40:02.939Z", "endDate": "2016-08-13T00:40:00.000Z", "completeDate": "2016-08-15T08:00:33.056Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "391749", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "So from what I'm understanding the issue is that you can get multiple calls if you close the app and re-open ? \r\n\r\nIf so then that's to be expected, once you open the app the notification is scheduled. If you keep closing and re-opening the app you will schedule multiple notifications. Also in your javascript code, you're scheduling a new notification every time you receive one. ", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-07-27T23:26:02.000+0000", "updated": "2016-07-27T23:26:02.000+0000" }, { "id": "415710", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket with reference to the previous comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T18:55:33.000+0000", "updated": "2017-03-24T18:55:33.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }