[AC-6379] TabGroup Activity not firing onStart callback
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Needs more info |
Resolution Date | 2019-11-05T22:49:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Ray Belisle |
Assignee | Shak Hossain |
Created | 2019-09-24T15:47:30.000+0000 |
Updated | 2019-11-05T22:49:11.000+0000 |
Description
Using the following code to test, when you compile with 7.5.2.GA the alert box is shown, when compiled with 8.0.x, the alert box is never shown.
var tg = Ti.UI.createTabGroup();
var t = Ti.UI.createTab();
var w = Ti.UI.createWindow();
tg.addEventListener('open', function() {
tg.getActivity().onStart = function(e){
alert("ACTIVITY START");
};
});
t.add(w);
tg.add(t);
tg.open();
As of 8.0.0, we've made breaking changes to activity callback handling to settle various issues developers were having with its old design. For your info, how it worked before was that an activity's callback was not invoked immediately. It was instead queued to be invoked later (which allowed your code to work). The issue with that was the "onDestroy" callback would never get invoked for the last window during an app exit. The other issue is that some devs need immediate feedback when the app is going in/out of the foreground via the onStart/onStop callbacks because some native Android APIs will refuse to work while backgrounded. To see the details, have a look here... https://github.com/appcelerator/titanium_mobile/pull/10733 That said, the real issue is that you are setting up your "onStart" callback too late. You need to set it up before opening the window as shown below. This will work on both the older and newer versions of Titanium.
Hello! Hope you are doing fine today. Would you please reply us regarding previous reviews? We are looking forward to your response. Best Regards, Customer Support Team