check activity state before showing connection/failure dialogs.