4.4.1 Inbox Objects

Inbox objects have the following functions:

sms_messages( )
Returns a list of SMS message IDs in device inbox.

content( sms_id)
Retrieve the SMS message content in Unicode.

time( sms_id)
Retrieve the SMS message time of arrival in seconds since epoch.

address( sms_id)
Retrieve the SMS message sender address in Unicode.

delete( sms_id)
Delete the SMS message from inbox.

unread( sms_id)
Returns the status (1=unread, 0=read) of the SMS with id.

set_unread( sms_id, status)
Set the status (1=unread, 0=read) of the SMS with id.

bind( callable)
Bind a callback to receive new message events in device inbox. When a new message arrives to the device inbox the callback gets called with the received message ID. The received message can be other than an SMS message.

If the message received is deleted immediately after e.g. checking the message content, the "new message" sound and dialog are not activated. This functionality might be useful in notification type of applications.

Examples:

>>> import inbox
>>> i=inbox.Inbox() # Give inbox.ESent as parameter for sent SMSes
>>> m=i.sms_messages()
>>> i.content(m[0])
u'foobar'
>>> i.time(m[0])
1130267365.03125
>>> i.address(m[0])
u'John Doe'
>>> i.delete(m[0])
>>>

>>> import inbox 
>>> id=0 
>>> def cb(id_cb):
...   global id 
...   id=id_cb
... 
>>> i=inbox.Inbox()
>>> i.bind(cb)
>>> # Send an SMS to your inbox here. The "id" gets updated
>>> i.address(id)
u'John Doe'
>>> i.content(id)
u'print 1'
>>>

See About this document... for information on suggesting changes.