Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6379] TabGroup Activity not firing onStart callback

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2019-11-05T22:49:11.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterRay Belisle
AssigneeShak Hossain
Created2019-09-24T15:47:30.000+0000
Updated2019-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();

Comments

  1. Joshua Quick 2019-09-25

    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.
       tg.getActivity().onStart = function(e) {
       	alert("ACTIVITY START");
       };
       tg.open();
       
  2. Rakhi Mitro 2019-09-29

    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

JSON Source