[TIMOB-27864] iOS: Support for new iOS 13 background tasks
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | 2020-Q4 |
Reporter | Jan Vennemann |
Assignee | Ewan Harris |
Created | 2020-04-24T18:20:56.000+0000 |
Updated | 2021-08-20T14:35:10.000+0000 |
Description
With iOS 13 a new framework for handling background tasks was added: [BackgroundTasks](https://developer.apple.com/documentation/backgroundtasks)
We should add support for this new framework.
* Can be used to periodically launch the app in the background and do some work
* Two types of tasks are available: A short refresh task and processing task that can take minutes to complete.
Initial WIP PR: https://github.com/appcelerator/titanium_mobile/pull/11689
PR - https://github.com/appcelerator/titanium_mobile/pull/12411
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: 1. Can this be triggered from silent push notifications? 2. What are the limits regarding network requests? An example would help a lot here. It's a superb feature!
Test Case -
How to test - One can not test it simply as we are not sure when system will invoke the app from background. 1. Create a sample app with given test case and add keys
BGTaskSchedulerPermittedIdentifiers
andUIBackgroundModes
with relevant values in tiapp.xml. 2. Run it on device (not simulator). 3. Open the generated Xcode project (.xcodeproj) in Xcode from build/iPhone folder. 4. Select the target, select Build Phases-> click on ' +' and select 'New Run Script Phase'. 5. Paste following script in Run Script.6. Now run the app in device using Xcode. 7. Bring the app in background and then bring it to foreground. Then in Xcode press pause button in debugger. 8. Paste
and enter. It should change the label text. Note - For step 7 & 8 you can follow Testing section of [this](https://www.andyibanez.com/posts/modern-background-tasks-ios13/)
We're removing this ticket from 10.1.0 due to the large scope and uncertainty given multiple PRs