×
Namespaces

Variants
Actions
Revision as of 10:10, 11 January 2012 by hamishwillee (Talk | contribs)

Archived:How read SMS in the inbox using PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Python provides inbox module to read SMS from your phone Inbox. It can also notify you when a new message arrives in your Inbox.

Article Metadata
Tested with
Devices(s): Nokia N96
Compatibility
Platform(s): S60 3rd Edition
Article
Keywords: inbox, SMS
Created: cyke64 (19 Mar 2007)
Last edited: hamishwillee (11 Jan 2012)

Code

Read Message

# import module
import inbox
 
i = inbox.Inbox()
m = i.sms_messages() # all message ID's
content_m=i.content(m[0]) # first message
print i.time(m[0]) # arrive time
print i.address(m[0]) # Only name is given :(

Notification on New Message

  • The following function will five a note whenever a new message will arrive. If we use globalui module then we will have a global notification, irrespective of our application being in background.
# import modules
import inbox
import appuifw
import e32
 
# Give note on new message
def message(msgid):
box = inbox.Inbox()
appuifw.note(u"A new message:\n %s" % box.content(msgid))
app_lock.signal()
 
# bind inbox to new message event
box = inbox.Inbox()
box.bind(message)
 
# Wait for Exit
app_lock = e32.Ao_lock()
app_lock.wait()

Related Links

92 page views in the last 30 days.