|
1.How to Send an SMS
#
import the messaging module
import appuifw, messaging
# create text input field
msg = appuifw.query(u"Type your name:", "text")
# define the mobile numbers here
mon = "+919974112262"
# define the text that the sms shall contain
msg_txt = u"HI from" +msg
messaging.sms_send(mon, msg_txt)
# confirm with a pop-up note that the sms has been sent out
appuifw.note(u"Messages sent", "info")
|
|
2.How to Check and Read an SMS
import appuifw,e32
import inbox
#define exit function
def quit():
app_lock.signal()
#define the check function
def check():
i=inbox.Inbox()
id=i.sms_messages()[0]#get the id of the recent msg.
if(i.unread(id)==1):
appuifw.note(u"unread","info")
else:
appuifw.note(u"read","info")
#define the read function
def read():
i=inbox.Inbox()
id=i.sms_messages()[0]
print i.content(id) #print the content of the msg
#define the delete function
def de():
i=inbox.inbox()
id=i.sms_messages()[0]
i.delete(id)# delete the msg
#create the application menu
appuifw.app.menu=[(u"Check Msg",check), (u"Read Msg",read), (u"de",de)]
appuifw.app.exit_key_handler = quit
app_lock = e32.Ao_lock()
app_lock.wait()
|