{ "id": "174952", "key": "TIMOB-27864", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": null, "resolutiondate": null, "created": "2020-04-24T18:20:56.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "2020-Q4" ], "versions": [], "issuelinks": [ { "id": "58437", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "165110", "key": "TIMOB-24257", "fields": { "summary": "Hyperloop: Example code required for calling notification service and background service", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "updated": "2021-08-20T14:35:10.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "With iOS 13 a new framework for handling background tasks was added: [BackgroundTasks|https://developer.apple.com/documentation/backgroundtasks]\r\n\r\nWe should add support for this new framework.\r\n\r\n* Can be used to periodically launch the app in the background and do some work\r\n* Two types of tasks are available: A short refresh task and processing task that can take minutes to complete.", "attachment": [], "flagged": false, "summary": "iOS: Support for new iOS 13 background tasks", "creator": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 1201, "state": "closed", "name": "2020 Sprint 14", "startDate": "2020-07-06T15:40:00.000Z", "endDate": "2020-07-17T15:40:00.000Z", "completeDate": "2020-07-20T22:16:28.367Z", "originBoardId": 114 }, { "id": 1217, "state": "closed", "name": "2021 Sprint 4", "startDate": "2021-02-16T00:52:00.000Z", "endDate": "2021-02-27T00:52:00.000Z", "completeDate": "2021-02-28T18:56:28.465Z", "originBoardId": 114 }, { "id": 1202, "state": "closed", "name": "2020 Sprint 15", "startDate": "2020-07-20T22:16:05.601Z", "endDate": "2020-07-31T22:16:00.000Z", "completeDate": "2020-08-03T20:27:12.585Z", "originBoardId": 114 }, { "id": 1203, "state": "closed", "name": "2020 Sprint 16", "startDate": "2020-08-03T20:57:55.114Z", "endDate": "2020-08-14T20:57:00.000Z", "completeDate": "2020-08-14T15:19:51.647Z", "originBoardId": 114 }, { "id": 1219, "state": "closed", "name": "2021 Sprint 5", "startDate": "2021-03-01T19:02:00.000Z", "endDate": "2021-03-12T19:02:00.000Z", "completeDate": "2021-03-15T03:30:49.472Z", "originBoardId": 114 }, { "id": 1220, "state": "closed", "name": "2021 Sprint 6", "startDate": "2021-03-15T03:31:12.088Z", "endDate": "2021-03-27T03:31:00.000Z", "completeDate": "2021-03-26T19:18:15.760Z", "originBoardId": 114 }, { "id": 1221, "state": "closed", "name": "2021 Sprint 7", "startDate": "2021-03-29T19:18:00.000Z", "endDate": "2021-04-09T19:18:00.000Z", "completeDate": "2021-04-12T21:26:15.427Z", "originBoardId": 114 }, { "id": 1222, "state": "closed", "name": "2021 Sprint 8", "startDate": "2021-04-12T21:26:41.532Z", "endDate": "2021-04-23T21:26:00.000Z", "completeDate": "2021-04-28T15:13:56.824Z", "originBoardId": 114 }, { "id": 1223, "state": "closed", "name": "2021 Sprint 9", "startDate": "2021-04-26T15:14:42.215Z", "endDate": "2021-05-07T15:14:00.000Z", "completeDate": "2021-05-17T16:30:45.852Z", "originBoardId": 114 }, { "id": 1199, "state": "closed", "name": "2020 Sprint 13", "startDate": "2020-06-19T16:41:04.099Z", "endDate": "2020-07-02T16:41:00.000Z", "completeDate": "2020-07-02T15:37:12.455Z", "originBoardId": 114 }, { "id": 1215, "state": "closed", "name": "2021 Sprint 2", "startDate": "2021-01-18T20:36:00.000Z", "endDate": "2021-01-29T20:36:00.000Z", "completeDate": "2021-01-31T17:42:28.052Z", "originBoardId": 114 }, { "id": 1216, "state": "closed", "name": "2021 Sprint 3", "startDate": "2021-02-01T17:42:00.000Z", "endDate": "2021-02-12T17:42:00.000Z", "completeDate": "2021-02-12T22:01:52.235Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "455894", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Initial WIP PR: https://github.com/appcelerator/titanium_mobile/pull/11689", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-06-19T16:23:19.000+0000", "updated": "2020-06-19T16:23:19.000+0000" }, { "id": "458071", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR - https://github.com/appcelerator/titanium_mobile/pull/12411", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-01-23T00:54:59.000+0000", "updated": "2021-01-27T01:17:26.000+0000" }, { "id": "458074", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thank you for covering this! Question: What's the difference of this API compared to the existing API? It would be great to have some docs around it. Also two questions:\r\n\r\n1. Can this be triggered from silent push notifications?\r\n2. What are the limits regarding network requests?\r\n\r\nAn example would help a lot here. It's a superb feature!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2021-01-23T12:27:24.000+0000", "updated": "2021-01-23T12:31:53.000+0000" }, { "id": "458083", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Test Case - \r\n\r\n{code:java}\r\nconst win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nconst label = Ti.UI.createLabel({\r\n text: 'Background task',\r\n});\r\n\r\nwin.add(label);\r\nwin.open();\r\n\r\nTi.App.iOS.registerBackgroundTask({\r\n\t'identifier': 'com.test.bgrefresh',\r\n\t'type': Ti.App.iOS.BACKGROUND_TASK_TYPE_REFRESH,\r\n});\r\n\r\nTi.App.iOS.registerBackgroundTask({\r\n\t'identifier': 'com.test.bgprocessing',\r\n\t'type': Ti.App.iOS.BACKGROUND_TASK_TYPE_PROCESS,\r\n\t'powerConnect': true,\r\n\t'networkConnect': true\r\n});\r\n\r\nTi.App.iOS.addEventListener('backgroundfetch', function(e) {\r\n Ti.API.info('backgroundfetch: ' + JSON.stringify(e));\r\n\r\n label.text = 'backgroundfetch';\r\n\r\n Ti.App.iOS.endBackgroundHandler(e.handlerId);\r\n});\r\n\r\nTi.App.iOS.addEventListener('backgroundprocess', function(e) {\r\n Ti.API.info('backgroundprocess: ' + JSON.stringify(e));\r\n\r\n label.text = 'backgroundprocess';\r\n \r\n Ti.App.iOS.endBackgroundHandler(e.handlerId);\r\n});\r\n{code}\r\n\r\nHow to test -\r\nOne can not test it simply as we are not sure when system will invoke the app from background.\r\n1. Create a sample app with given test case and add keys `BGTaskSchedulerPermittedIdentifiers` and `UIBackgroundModes ` with relevant values in tiapp.xml.\r\n2. Run it on device (not simulator).\r\n3. Open the generated Xcode project (.xcodeproj) in Xcode from build/iPhone folder.\r\n4. Select the target, select Build Phases-> click on ' +' and select 'New Run Script Phase'.\r\n5. Paste following script in Run Script.\r\n{code:java}\r\ncp ${SRCROOT}/build/Products/Debug-iphoneos/${CONTENTS_FOLDER_PATH}/_index_.json ${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/_index_.json\r\n{code}\r\n6. Now run the app in device using Xcode.\r\n7. Bring the app in background and then bring it to foreground. Then in Xcode press pause button in debugger.\r\n8. Paste \r\n{code:java}\r\ne -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@\"com.test.bgrefresh\"]\r\n{code}\r\nand enter. It should change the label text.\r\n\r\nNote - For step 7 & 8 you can follow Testing section of [this|https://www.andyibanez.com/posts/modern-background-tasks-ios13/]\r\n", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-01-26T21:19:52.000+0000", "updated": "2021-01-26T21:19:52.000+0000" }, { "id": "459000", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "We're removing this ticket from 10.1.0 due to the large scope and uncertainty given multiple PRs", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2021-08-20T14:34:31.000+0000", "updated": "2021-08-20T14:34:31.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }