{ "id": "136678", "key": "TIMOB-17707", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": [ { "id": "15972", "description": "Release 3.4.0", "name": "Release 3.4.0", "archived": false, "released": true, "releaseDate": "2014-09-28" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-09-26T20:15:37.000+0000", "created": "2014-09-16T21:12:37.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-11-21T20:22:58.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": "Change Ti.App.iOS event name from 'backgroundNotification' to 'localnotificationaction'.\r\n\r\nThe current name of the event does not accurately reflect the purpose of the event. Because of this, it needs to be changed to something more meaningful.\r\n\r\nh5. Test Instructions\r\n1. Run the code below\r\n2. Click 'registerUserNotificationSettings' and then Allow\r\n3. Click 'scheduleLocalNotification'\r\n4. Background the app\r\n5. Swipe down from the top of the device to see the notification center\r\n6. Swipe the notification to the left and click one of the buttons\r\n7. If 'localnotificationaction' is displayed in the device log, then the event was fired correctly\r\n\r\n{code}\r\nvar rows = [\r\n {\r\n title: 'currentUserNotificationSettings',\r\n onClick: function(){\r\n // iOS 8 +\r\n var settings = Ti.App.iOS.currentUserNotificationSettings;\r\n logUserNotificationSettings(settings);\r\n }\r\n },\r\n {\r\n title: 'registerUserNotificationSettings',\r\n onClick: function(){\r\n // iOS 8 +\r\n // The following action launches the application in the foreground and requires the device to be unlocked\r\n var acceptAction = Ti.App.iOS.createUserNotificationAction({\r\n identifier: \"ACCEPT_IDENTIFIER\",\r\n title: \"Accept\",\r\n activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_FOREGROUND,\r\n destructive: false,\r\n authenticationRequired: true\r\n });\r\n \r\n var foregroundCategory = Ti.App.iOS.createUserNotificationCategory({\r\n identifier: \"FOREGROUND_CATEGORY\",\r\n // The following actions will be displayed for an alert dialog\r\n actionsForDefaultContext: [acceptAction],\r\n // The following actions will be displayed for all other notifications\r\n actionsForMinimalContext: [acceptAction]\r\n });\r\n \r\n Ti.App.iOS.registerUserNotificationSettings({\r\n types: [Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT,\r\n // Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,\r\n Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE],\r\n categories: [foregroundCategory]\r\n });\r\n }\r\n },\r\n {\r\n title: 'scheduleLocalNotification',\r\n onClick: function(){\r\n Ti.App.iOS.scheduleLocalNotification({\r\n date: new Date(new Date().getTime() + 3000),\r\n alertBody: \"New content available! Download now?\",\r\n badge: 1,\r\n userInfo: {\"url\": \"http://www.download.com/resource/asset.json\"},\r\n category: \"FOREGROUND_CATEGORY\"\r\n });\r\n }\r\n }\r\n];\r\n \r\nfunction logInApp(text) {\r\n textLog.value = textLog.value + '\\n' + text;\r\n}\r\n \r\nfunction logUserNotificationSettings(settings) {\r\n logInApp('UserNotificationSettings: ');\r\n logInApp('types: ' + JSON.stringify(settings.types));\r\n var categories = [];\r\n for (var i = 0, j = settings.categories.length; i < j; i++) {\r\n categories.push(settings.categories[i].identifier);\r\n }\r\n logInApp('categories: ' + JSON.stringify(categories));\r\n}\r\n \r\nTi.App.iOS.addEventListener('usernotificationsettings', function(e) {\r\n logInApp('Event: usernotificationsettings');\r\n logUserNotificationSettings(e);\r\n});\r\n\r\nTi.App.iOS.addEventListener('localnotificationaction', function(e) {\r\n logInApp('localnotificationaction');\r\n logInApp('- category: ' + e.category + ' identifier: ' + e.identifier);\r\n});\r\n \r\n////////////////////////////////////////////////////////\r\n// UI\r\n////////////////////////////////////////////////////////\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'white'\r\n});\r\nwin.open();\r\n \r\nvar textLog = Ti.UI.createTextArea({\r\n top: 0,\r\n height: '20%',\r\n width: '100%',\r\n borderWidth: '2',\r\n borderColor: '#000',\r\n value: 'AppLog: see device log for more info'\r\n});\r\nwin.add(textLog);\r\n \r\nvar tableView = Ti.UI.createTableView({\r\n top: '20%',\r\n data: rows\r\n});\r\ntableView.addEventListener('click', function(e){\r\n e.source.onClick && e.source.onClick();\r\n});\r\nwin.add(tableView);\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS8: change Ti.App.iOS event name from 'backgroundNotification' to 'localnotificationaction'", "creator": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 219, "state": "closed", "name": "2014 Sprint 19 SDK", "startDate": "2014-09-18T21:06:27.559Z", "endDate": "2014-09-27T00:00:00.000Z", "completeDate": "2014-09-29T13:58:58.022Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "324075", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR: https://github.com/appcelerator/titanium_mobile/pull/6101\r\n3_4_X PR: https://github.com/appcelerator/titanium_mobile/pull/6102", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-16T21:46:37.000+0000", "updated": "2014-09-16T21:46:37.000+0000" }, { "id": "324139", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed. Verified localnotification event gets fired instead of backgroundNotification.\r\n\r\nTested on:\r\n\r\nAppcelerator Studio, build: 3.4.0.201409131030\r\nSDK build: 3.4.0.v20140916151649\r\nCLI: 3.4.0-rc4\r\nAlloy: 1.5.0-rc2\r\nXcode: 6 GM Seed\r\nDevice: iphone 5 (8.0 GM Seed)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-09-17T01:25:37.000+0000", "updated": "2014-09-17T01:25:37.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }