Texting1.messageReceived shows "Invalid message body"

114 views
Skip to first unread message

Rula Gh

unread,
Aug 12, 2017, 6:48:23 AM8/12/17
to MIT App Inventor Forum
Hi, 

I'm using the texting component so that whenever I receive a msg my phone automatically replies with a custom msg and reads me the msg I've received. 
When testing my app whenever I receive a msg it shows me "Invalid message body" on my phone and "Invalid message body<br/><i>Note:</i>&nbsp;You will not see another error reported for 5 seconds." on my code, 
Can anyone help? 
I'm using Opera browser, OS: windows 10.

Thanks. 

תמונה1.png

SteveJG

unread,
Aug 12, 2017, 9:02:48 AM8/12/17
to mitappinv...@googlegroups.com
You need to do some detective work.  First, are you testing using Companion or the compiled apk? The compiled app might behave differently. Have you tried both?

You are aware, AI2 apps process code asynchronously and doing so frequently may cause issues in event handlers like the MessageReceived block.
Read this article on debugging http://www.appinventor.org/bookChapters/chapter15.pdf  ; then perform a DoIt  on the contents of MsgLbl.txt .  Is there 
actually a text message under 170 characters length including spaces (for some language alphabets, the length is limited to 160 characters I believe).  No message (an empty label)  or a message exceeding parameters could elicit "InvalidMessageBody."  Text messages on AI2 are restricted to 170 characters or less.

See figure 4-3 in the MIT No Texting While Driving tutorial  http://www.appinventor.org/bookChapters/chapter4.pdf    
Your code is similar to figure 4-10 so a best guess is that MsgLbl.txt does not contain a message or a message that contains characters that the TextingComponent cannot resolve ... is the text in utf-8 format?  If the text is in English does the code work and does not only when texting in your language?

You could download the aia for this example and test it in your phone ... the download is at  http://www.appinventor.org/bookFiles   Does the compiled aia work?

Regards,
Steve



Ghica

unread,
Aug 12, 2017, 5:45:21 PM8/12/17
to MIT App Inventor Forum
What is in MsgLbl.Text? Is it a valid message?
Cheers, Ghica.
Reply all
Reply to author
Forward
0 new messages