Send SMS Directly Runtime Error

Is anyone able to send an SMS message automatically using SendMessageDirect? I am getting:
Runtime Error: SendMessageDirect is not supported. Use SendMessage instead.
Note: You will not see another error reported for 5 seconds.

I can't use the SendMessage function because I need to send SMS messages automatically without any user intervention. (Having the default messenger app open up is not going to work for my case.)

1 Like

Hello Christine

That is a Google Security Measure. If your App is not going to be distributed via Google Play, you can set your App to 'legacy mode' and that will allow Send Message Direct. Problem is, I see that version nb188 doesn't seem to offer Legacy Mode. I will see what I can find out.

2 Likes

@Christine If you want to use the companion to test blocks disallowed by Google Play Store policies, you will need to install the version of the companion app available directly through the App Inventor servers. You can download that companion via http://ai2.appinventor.mit.edu/companions/MITAI2Companion.apk. There is also a QR code you can scan with your device under the Help > Companion Information dialog menu in App Inventor.

What about APKs Evan?

The appropriate permissions are included when the app is compiled. The error message Christine is seeing only appears in the companion, and only the companion published in the Play Store due to Google policy.

Ah that's all cool then. Words to that effect need to be in the Help.

Well, this is what the documentation has to say:

SendMessageDirect()
Send a text message. Using this block will add dangerous permissions that will require additional approval if your app is submitted to the Google Play Store.

Which I at least feel is as strong as what I wrote:

Unless you are referring to my statement about the error message?

Certainly, the Companion available directly via the AI Servers needs to be in the Help - Why not have all the 'dangerous' Blocks gathered together on one help page, or a link to a page that further explains the situation and itself has a link to the directly available Companion.

Although perfectly correct, most young Users will understand 'dangerous permissions' as do-not-use the Block whereas this is only the stance of Google and not other platforms - yet the fact that other platforms/methods could be used to distribute Apps is not mentioned.