added support for app suspend, resume and visibility