log event when user exits the app

Hi,

I am working with flurry analytics and working good. Event logging is working fine. But I need help for some specific condition. I need to log event at flurry when user exits the app. I need to tell that user was on which page when he/she exits the app. I am doing it this way but its not working.

local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
analytics.logEvent(“User was on X page when he quits the App”)
end
end
Runtime:addEventListener( “system”, onSystemEvent )

I have added this code to all pages with X being the page title but its not working. Other events are logged fine. Please guide me about this.

Thanks

[import]uid: 126619 topic_id: 34896 reply_id: 334896[/import]