Another I tried on SL4A is to play with their SMS function. So, with the resulting code below:
- 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.
droid = android.Android()
result = droid.smsGetMessages(True)
for i in result.result:
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’address’: u’Address of sender aka the phone no’,
u’body’: u’Message Body’,
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.
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….