modify app background foreground event