[ALOY-1732] Add ability to run in the background without UI
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-08-12T14:28:28.000+0000 |
Affected Version/s | n/a |
Fix Version/s | CLI Release 8.1.0 |
Components | n/a |
Labels | alloy, android, background, ios |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2020-06-03T02:55:54.000+0000 |
Updated | 2020-08-12T14:28:28.000+0000 |
Description
*Summary:*
We plan on adding a new "tiapp.xml" property "run-in-background", when set
true
, will allow the "app.js" to be executed while the app is in the background and is unable to host UI. This means we have to defer root window creation until the app is ready to host UI. On Android, we also need to support recreation of the root window when user backs out of the app and re-launches it.
See Titanium SDK ticket [TIMOB-27896] for details.
*To-Do:*
The "app.js" generated by Alloy needs to be changed to the following...
// Open root window if a new UI session has started. Can happen more than once in app's lifetime.
// Event can only be fired if "tiapp.xml" property "run-in-background" is set true.
Ti.UI.addEventListener('sessionbegin', function () {
Alloy.createController('index');
});
// Open the root window immediately if an active UI session exists.
// Note: The Ti.UI.hasSession property was added as of Titanium 9.1.0.
if ((typeof Ti.UI.hasSession === 'undefined') || Ti.UI.hasSession) {
Alloy.createController('index');
}
*Note:*
We need to release this Alloy change via CLI 8.1.0 before we release Titanium 9.1.0. The new Titanium backgrounding feature won't work correctly on Alloy without it. The plan is to have the Titanium 9.1.0 build system check that CLI 8.1.0 is installed when the backgrounding feature is enabled in the "tiapp.xml" or else we'll trigger a build failure.
PR (master): https://github.com/appcelerator/alloy/pull/959
Test steps: This isn't really testable until TIMOB-27896 is merged, but for now just testing that apps launch fine with this change will do
Closing ticket, fix verified in CLI version 8.1.0-master.10, app launches just fine.