PhoneGap: Handle application events