Archived:How to check if the application is in background
Article Metadata
For some programs it may be useful to know whether they are running in the background or in the foreground. This is how to check the focus state of a program (using the standard PySymbian appuifw module):
import appuifw
#A function that tells us the focus status of the application is defined
def foc(status):
if(status==1):print 'App is now in the foreground'
else:print 'App is now in the background'
#We assign the function to the focus item of the Application class in appuifw
appuifw.app.focus=foc

