invoke enter background and foreground event in lua