No text while driving compiling not working

I am going through the No Texting While Driving tutorial. Doing everything just as it says. Obviously I've read that the current emulator won't allow texting if downloaded from the store. So I downloaded the 2.60u.

However, in the tutorial, it allows you to download the .apk and .aia. When I download the .apk to my phone, it works. When I download the .aia, upload to MIT App Inventor and CHANGE NOTHING, then compile into an .apk, suddenly it doesn't work. Even the phone won't recognize as an android app. It will install and open but the icons are different, suggesting my phone sees it differently. Also the size of the files are different:
Downloaded .apk: 2.1Mb
Downloaded.aia>Built .apk: 4.2Mb

So clearly there is a difference between these files. What am I doing wrong when I compile in the App? Will this never work?

Apparently the .aia file in the tutorial is outdated and incompatible with ai2, possibly it was created in a previous version of ai1. I think you need to create your project from scratch with the help of a tutorial. Then the tutorial makes sense and you will learn something.

@Patryk_F is partially correct. The NoTexting tutorial was written when the default ReceivingEnabled was Foreground. If you have this set to Off, set it to Foreground or Always. Following the discussion here to update the App Inventor 2 aia.

Problem Receiving SMS's - #2 by SteveJG to fix your aia.

The original App Inventor 2 version of the tutorial is circa 2014; it is now 2021 and changes to the AI2 compiler (additional components etc.)since the tutorial apk was built probably now result in a larger build. Don't worry about it.

1 Like

No it wasn't a date issue. I was building it and it wasn't working because of the Receiving enabled feature.

This worked! Thanks. Sorry if it was a repeat question. I was reading and not seeing it. Also, it won't auto send texts. Just preps the text and I still have to click send. Is there a workaround?

1 Like

Probably substituting the green checked Block for the red x block?

ntwdriving

Explained here> Texting

SendMessage() launchs the phone’s default text messaging app with the message and phone number prepopulated.

SendMessageDirect() will 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.

1 Like

I have the same issue. I still have to hit the send key on my phone to send message.

Contrary to appearances, clicking is a very good option. It prevents the creation of spamming applications and sending text messages to premium numbers.

1 Like

See above. Use sendmessagedirect. It seemed to work for me.

can you show me your blocks for i have tried that and received error about unable to create GVHelper.

also, Do you have to hit the send key on your phone to send response? I do. I switched back to the regular sendMessage block.

@Nicholas_Cossentino

Exactly what have you tried Nicholas? You did not share your Blocks so I can only guess at your difficulties.

  • are you trying to run this on the emulator or using Companion? If I compile my app and load it on a device that has an active cell phone account, the SendMessageDirect Block works fine automatically. You must set the ReceivingEnabled to 2 or 3. Read Social and the caution statements.

    This code snippet works:

noTexting

Does your code look similar?

  • regarding gVHelper. Are you attempting to use GoogleVoice on a tablet. That never worked for me. Uncheck GoogleVoiceEnabled in the Designer if you have the box checked and test on a real cell phone. I don't get your error message.
    On some cell networks, you can test by sending a Text to yourself (your cell phone number).

No, the above code works on an Android 4.2. If you use Companion 2.60u you should have no problems. What version of Android are you using.? The code sends a text to yourself and a few seconds later it is received in your Texting app.