- As usual import library, and create the Android() object
- and from the Android object call smsGetMessages, with a required parameter for unread message, True for unread only, false for other wise.
- and call the build in android Text To Speech software to read it out, by calling ttsSpeak method.
import android
droid = android.Android()
result = droid.smsGetMessages(True)
for i in result.result:
droid.ttsSpeak(i['body'])
the result in the output is a list of such dictionary, in python notnion. Since I only want the message so I call it by i['body']
{u'_id': u'59',the date is the datetime read and the read is 1 is read, and 0 otherwise. The ttsSpeak method is easy to use too, just pass in a string.
u'address': u'Address of sender aka the phone no',
u'body': u'Message Body',
u'date': u'1300254988000',
u'read': u'1'}
Originally I read all messages, and pass to the tts library. Turn out to be a bad idea, because I have no idea how to stop it from speaking once it started....