This tutorial introduces the Texting component for sending and processing texts. You'll build an app that texts a message to a list of phone numbers.
This tutorial assumes you've completed the HelloPurr, PaintPot, and WhackAMole tutorials. It introduces the following App Inventor concepts:
Do we need to assume that they have completed these tutorials of that they know certain funtionality explained in these tutorials? I would argue the later. So maybe we say something like: This tutorial assumes you know how to do X, Y, and Z, explained in the HelloPurr, PaintPot, and WhackAMole tutorials.
Properties panel on the right of the Designer and change the screen Title to Text Group. You should see this change on phone, with the new title showing in the title bar.
I am not sure how to interrpret this. I started off looking for a companent named message text. I clicked on the help text (?) and read the descripotion and figured out that the TextBox was the componant I was looking for. Should we make this more obvious? Maybe someting like...
Text Random button in the picture is not listed above.
Your goal is the following: When the user clicks the TextGroupButton,
the app should text the message entered by the user in MessageText to all the numbers in a list of phone numbers.
Version 0.1: Text the entered message to one phone number.
To introduce yourself to the Texting component, begin by creating a simplified version that texts your own phone the message entered by the user. To send a text, you need to set two properties of the Texting component: the PhoneNumber and the Message. Once these are set, you can call the SendMessage function to actually send the text.
In the Blocks Editor:
I think we can reduce the text here by either building a table and/or justing displaying the blocks.
Version 1.0. Texting a list
Next, you'll modify the blocks to do what you really want, which is to text more than one number at a time. A brute force method would be to just copy the blocks to text a particular number, paste them a number of times, then change the phone numbers on each. This brute force method would look like this (you need not actually code these blocks for this tutorial):
This copy-paste scheme would work, but it's inconvenient to copy, paste, and modify blocks each time you want to add a number to the list. Furthermore, only the programmer can add new numbers to the list in this manner. If you want to extend this app to allow the user of the app to add and remove numbers, a different scheme is necessary.
A better solution is to define a variable (is there another way to talk about variables or maybe we say something like "A better solution would be to XXXXX, which is what we call defining a variable"?) that stores the list of numbers, then specify that the set of operations (set PhoneNumber, SendMessage) should be repeated on each item in that list. With such a solution, the programmer (or user) can simply add items to the list, and the blocks for executing operations on that list need not change. The app is more maintainable and it can be modified to work on even dynamic data lists.In this app, like many apps, you''ll define global variables to store the data for the app. Global variables are not seen by the user-- they are hidden memory cells (what are memory cells?) within the phone. In this case, you'll define the list of phone numbers to which the text is sent.
Again I think we can reduce the text here by building a table.
Now you're ready to code the TextGroupButton event-handler so that it texts each number in the variable PhoneNumbers.
Now you're ready to specify the "repeatable" blocks. In Version 0.1, you texted a single number:
Test the app by clicking the TexGroupButton on the phone. Is the text sent to all the numbers in the list?
From the StatusLabel drawer, drag out a set StatusLabel.Text to block and place a text block with the text, "sending texts..." within it. Place these blocks at the top of the TextGroupButton.Click event-handler, then copy them, (I am not sure what you mean by copy. I literally tried right clicking to see if I could copy the block. I than moved on to just repeat the dragging out of the set StatusLabel.Text block and placing the text block in it.) change the text to "texts sent.", and place those blocks at the bottom of the event handler:
Once you get the TextGroup app working, you might want to explore some variations. For example,
get rid of random blocks in early pics
maybe display the list of numbers to whom the message was sent.
missing a foreach block pic 2/3 way down