Incoming SMS Script Error

42 views
Skip to first unread message

emilio

unread,
Apr 1, 2017, 6:56:40 AM4/1/17
to DroidScript
I am develooping an app that handles commands parsing incoming SMS. All is ok when SMS are sent from other phones, but there is a big problem when my provider (CoopVoce in ITALY) send to my phone some information or publicity SMS that is without a number, just the name 'CoopVoce'. When this 'special' SMS is received, my running app stops to work and the following message is displayed: Scrip Error: CoopVoce is not defined. Following lines are from Debug window. How solve this problem?
  • App.CreateSMS( )
  • -> #15
  • SMS.SetOnStatus( sms_OnStatus )
  • SMS.SetOnMessage( sms_OnMessage )
  • Script Error: CoopVoce is not defined, Line 1,

Steve Garman

unread,
Apr 1, 2017, 8:31:12 AM4/1/17
to DroidScript
Emilio,
are you able to post the code that causes the problem?

It seems likely that it is part of your parsing code that is involved.

Are you trying to access the contacts database as part of your parsing?

emilio

unread,
Apr 1, 2017, 10:09:34 AM4/1/17
to DroidScript
Steve,
to be sure that I do nothing else, I am running exactly the sample 'SMS' that is proposed with DroidScript app.

I confirm that an incoming SMS from a my friend showes the  planned popup [App.ShowPopup( 39333xxxxxxx: test)], while the incoming SMS from my provider generates the described Script Error  [Script Error: CoopVoce is not defined, Line 1,].

In my opinion, there is something wrong with parameter 'number' of the function 'sms_OnMessage( number, msg )' when it is empty or null or not a number as for my case.

Steve Garman

unread,
Apr 1, 2017, 10:19:58 AM4/1/17
to DroidScript
Ok, I can replicate that.

It will take me a while to test out a workaround but I'll let you know how I get on.

Steve Garman

unread,
Apr 1, 2017, 10:43:06 AM4/1/17
to DroidScript
This is a nasty little bug caused by something internal trying to evaluate a string.

As a test, can you try adding this line at the very top of your code, before the OnStart function.

var CoopVoce = "Unknown";

Can you let me know if it works.

If it does, we have identified the problem and can ask Dave for a fix in a future version.

emilio

unread,
Apr 4, 2017, 3:27:21 AM4/4/17
to DroidScript
Your test is OK, now SMS coming from my provider are not detected by DroidScript so app does not get Script Error and does not stop to work. Normal SMS are detected and can be parsed.

However, I agree with you to fix it.

Thank you for your support,
Emilio.
Reply all
Reply to author
Forward
0 new messages