Hey all,
I have implemented the following program in Python s60 that waits for incoming messages and checks whether they are some kind of alert message from a predefined number.If so,it displays a message "Danger!!!" and waits for the user to press either Ok or Cancel.(also it starts playing an audio file infinitely).Depending on what the user presses,its either stops playing the file or starts again.
Alls fine till this.But,I want the application to run in background so that the user can do other stuffs too like attending calls and other things.Only when the specific message comes it display the alert message and start playing the audio file.It works with this too.But the problem is that the message is displayed only when I open the Python shell and I can only stop the audio file by opening the python shell.Code:import appuifw import inbox import e32 import logs import audio nbr="+00000" nbr_rec=0 app_lock = e32.Ao_lock() def message_recieved(msg_id): global app_lock,nbr box = inbox.Inbox() sms_text = box.content(msg_id) l=logs.sms(mode='in') nbr_rec = l[0]["number"] print (u"Number Recieved is "+str(nbr_rec)) if((nbr_rec==nbr) and (sms_text=="Test")): e32.ao_sleep(3) A = audio.Sound.open("C:\smsalertpolices03.mid") j=None A.play(audio.KMdaRepeatForever) while j is None: j=appuifw.query(u"Danger!!!","query") A.stop() A.close() app_lock.signal() box = inbox.Inbox() box.bind(message_recieved) print (u"Waiting for new SMS messages.....") app_lock.wait() print(u"Message handled!")
Is there any way to display the message/query globally and close the audio file from outside.
Plz Help me
Rishabh

Reply With Quote

.


