Revision as of 07:07, 27 July 2012 by hamishwillee (Talk | contribs)

Archived:How to check if the application is in background

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Created: bogdan.galiceanu (28 Mar 2008)
Last edited: hamishwillee (27 Jul 2012)

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
45 page views in the last 30 days.