Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3424] In trayClickFocusedApp eventListener only alert() is getting executed. Other Functions, fireEvents, etc. are not getting called inside eventListener.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-04-05T20:53:32.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid, cloudpush, trayClickFocusedApp
ReporterSuraj Datta
AssigneeShak Hossain
Created2016-03-29T15:26:17.000+0000
Updated2016-04-05T20:53:32.000+0000

Description

Code:
CloudPush.addEventListener('trayClickFocusedApp', function(evt) {
	alert("In trayClickFocusedApp event");	

	//Ti.App.fireEvent('TimelineRefresh');

	// Ti.App.fireEvent('messageRefresh', {
	//
	// });
	// Ti.App.fireEvent('listViewPhotoRefresh', {
	//
	// });
	// Ti.App.fireEvent('listViewRefresh', {
	//
	// });

});
In above code only alert() gets executed & if i uncomment those fireEvents, trayClickFocusedApp Event doesn't get called. Version Used: CloudPush : 3.4.1 Titanium SDK : 5.2.0

Attachments

FileDateSize
0-neu-d5-2f9fb89c7a021928872d1f453ee9ac86.jpg2016-03-29T20:28:06.000+000039795
0-neu-d5-729d0f7ecf240d71248b99b7fd452d1f.jpg2016-03-29T20:27:26.000+000037028

Comments

  1. Sharif AbuDarda 2016-03-29

    Hello, I have tried to reproduce the issue with SDK 5.2.1.GA. I can’t reproduce this issue. I have tested with Android 5.0.2. Below is the code that I am using.
       CloudPush.addEventListener('trayClickFocusedApp', function(evt) {
       	alert("In trayClickFocusedApp event");	
           Ti.API.info('Tray Click Focused App (app was already running)');
          
           function myFunction() {
               alert("my function");
           } 
           
           myFunction();
           
       });
       
    Both alert (trayClickFocusedApp and myFunction) was fired successfully. See the attachments. Also, in the console I got the response.
       [INFO] :   Tray Click Focused App (app was already running)
       
    I would suggest, defining your functions somewhere in the code and call the functions (as I did) inside the "trayClickFocusedApp" event listener. Also, Please share with us the full code that you are using. Regards, Sharif
  2. Suraj Datta 2016-03-30

    Hello Sharif, Thanks for your response. I noticed following behaviour wrt above Event. *Run1:* * Launched my app * Put it in background * Generated notifications * On click of notification, app gets focused but the fireEvents didn't get executed. * Exited my app. *Run2:* * Launched my app again * Put it in background * Generated notifications * Now on click of notification, the fireEvents & other codes gets executed on 2nd run. Thanks & Regards, Suraj Datta.
  3. Suraj Datta 2016-03-30

    Hello Sharif, Can you please test the above behaviours? Regards, Suraj Datta.
  4. Sharif AbuDarda 2016-03-30

    Hello [~Suraj Datta], I have tested again following the steps you have mentioned above. I wasn't able to reproduce your issue. Here is how I have tested it. 1.Build with SDK 5.2.1.GA. 2.Launched my app. 3.Put the app in background. 4.Generated notifications. 5.On click of notification, app gets focused myFunction(); get executed. 6.Console shows trayClickFocusedApp fired. Regards, Sharif

JSON Source