android - TTS reads out received sms, if sms exceeds normal 160 characters - will stop -
as in title. have tts reading out received messages. if message exceeds 160 characters, no read rest (which assume technically second text, linked 1 "big" message network provider) how can modify code if sms bigger standard single message, can read out? here snippet of code
public void onreceive(context context, intent intent) { int n; bundle bundle = intent.getextras(); object messages[] = (object[]) bundle.get("pdus"); smsmessage smsmessage[] = new smsmessage[messages.length]; (n = 0; n<messages.length; n++){ smsmessage[n] = smsmessage.createfrompdu((byte[])messages[n]); } string sms1 = smsmessage[0].getmessagebody(); /**send variable class handling tts, read out-loud corresponding method */ speakeractivity.speaksms(sms1);
each member of array in example contains 160 character part of message. if message happens exceed 160 characters, though android stitches these in default sms app, represented in parts in array. you'll need iterate on array find additional pieces of each long message.
Comments
Post a Comment