How to get a reference to the currently open modal window (in push notification callback)

You must Login before you can answer or comment on any questions.

Hi,

I have an app that I sometimes send push notifications to. When a push notification arrives, I use the callback to switch to the correct "news" tab that is related to this notification. However if a modal window is open at that moment, it still remains on top of everything. Is there a way to get a reference to that window and do close() on it. Besides doing this manually of course by recording open modals in a global var.

1 Answer

Accepted Answer

In the modal window, add an application event listener that closes the window..

// assuming your modal window object is myModalWindow
Ti.App.addEventListener('app:closeThisModalWindow',function(e){
myModalWindow.close();
});
Within your push notification callback, fire this event -
Ti.App.fireEvent('app:closeThisModalWindow',{});

Your Answer

Think you can help? Login to answer this question!