App decommunication : Hub Broadcast
Durée estimée: 90 minutes
(Teacher Tube version)
BroadcastHub This tutorial uses the App Inventor Texting Component to receive
and send text messages to a list of registered members. The device running the app is the
hub. Other devices can text "joinhub" to the hub to become a member. Messages sent to
the hub by registered members are distributed to all the members. This version is a variation
of the MIT tutorial
It assumes that you know how to set up your device for using the
Texting component over Wifi
(i.e., for devices with no Sim card or mobile service plan). The lesson includes several
programming exercises that add enhancements to the basic app.
Objectives: In this lesson you will learn to :
Building the BroadcastHub app
To get started open App Inventor with the BroadcastHub Template in a separate tab and follow along with these tutorials.
You can either click on the thumbnails to view the video or click here to read the tutorial.
Enhancements: Creative Projects
Here are some ideas for programming projects.
- Abstraction: Break the if-else code into more easily readable chunks by defining and using procedures with parameters.
- (If/Else Algorithm:) Modify the distributeTheMessage procedure so that it doesn’t distribute the message back to the sender of the message. HINT: You’ll need an if-else block for this.
- Add a Clock component to the app so that you can display a timestamp when a message is received. The Clock component contains methods that enable you to get the current time (Clock.Now) and format it into a date and time.
- Add a TextToSpeech component so that the new members can be ‘announced’ to the user when a ‘joinhub’ message is received.
- Persistence: Add a TinyDb so that the members of the hub can persist from one use of the app to another.
- Advanced: Modify the app so that it saves the members’ names, as well as, phone numbers of the members of the hub. HINT: Use a list of lists that includes the member’s name and phone number or use a delimited string such as: “5558885555:Joe” where the : separates the name from the phone number. For this latter approach you should design functions to get the name or the phone number parts from the string.
- Advanced: Modify the app so that a member can be removed from the hub. HINT: You will need to design a protocol for leaving the hub (e.g. ‘removemember’)
- Longer-term (Advanced) Project: Come up with your own variations of this app. For example, one variation might be to extend the app to have multiple hubs -- family, friends, etc. And, allow members to tag their messages with certain prefixes to indicate which distribution list should receive the message -- e.g. “family: The picnic is at 1 PM’
Choose all that apply.
Reflection: For Your PortfolioCreate a new page named Broadcast Hub under the Reflections category of your portfolio and write brief answers to the following questions:
- How is the For Each loop used in this app? What is the significance of this loop?
- Besides Texting and the For Each loop, what programming concept plays a significant role in the functionality of this app? Explain.