Hello World: Create Your First App in App Inventor (Text-to-Speech App)

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape

Have you ever wanted to make your phone talk? With MIT App Inventor, you can create a simple app that speaks whatever you type! Let’s embark on this exciting journey to build your very own Text-to-Speech app.

Mobile Applications

Getting Started

Before we begin, ensure you have the following:

  • A Computer: To access the App Inventor website.
  • A Google Account: For signing in to App Inventor.
  • An Android Device: To test your app (optional but recommended).

Step 1: Access App Inventor

  • Open your web browser and go to the MIT App Inventor website.
  • Click on “Create Apps!” and sign in with your Google account.

Step 2: Start a New Project

  • Once signed in, click on “Start new project.
  • Name your project HelloWorld and click “OK.”

Step 3: Design the User Interface

  • Add a Button:
    • From the “Palette” on the left, drag and drop a Button component onto the Viewer (the phone screen in the center).
    • In the “Properties” panel on the right, change the Button’s text to “Talk To Me.”
  • Add a Text Box:
    • From the “Palette,” drag and drop a TextBox component onto the Viewer, placing it above the Button.
    • In the “Properties” panel, clear the “Hint” property so it’s empty.
  • Add Text-to-Speech Component:
    • From the “Palette,” go to the “Media” drawer.
    • Drag and drop the TextToSpeech component onto the Viewer. It will appear below as a non-visible component.

Step 4: Program the App

  • Click on the “Blocks” button at the top-right to switch to the Blocks Editor.
  • Create the Button’s Function:
    • In the Blocks panel, click on “Button1” to see its blocks.
    • Drag the when Button1.Click do block into the workspace.
  • Set Up Text-to-Speech:
    • Click on “TextToSpeech” in the Blocks panel.
    • Drag the call TextToSpeech.Speak block into the when Button1.Click do block.
  • Define the Message to Speak:
    • Click on “TextBox1” in the Blocks panel.
    • Drag the TextBox1.Text block and connect it to the message socket of the call TextToSpeech.Speak block.

Step 5: Test Your App

  • Connect Your Device:
    • On your Android device, download and install the MIT AI2 Companion app from the Google Play Store.
    • In App Inventor, click on “Connect” and select “AI Companion.”
    • Open the AI2 Companion app on your device and scan the QR code displayed on your computer.
  • Test the Functionality:
    • On your device, enter text into the TextBox.
    • Press the “Talk To Me” button. Your device should speak the text you entered!

How to test your App?

Connecting your mobile device to MIT App Inventor using the AI2 Companion app allows you to test your applications in real-time. Here’s a step-by-step instructions:

1. Install the MIT AI2 Companion App

  • For Android Devices:

    • Open the Google Play Store on your device.
    • Search for “MIT AI2 Companion.”
    • Select the app from the search results and tap “Install” to download and install it.
  • For iOS Devices:

    • Open the App Store on your device.
    • Search for “MIT AI2 Companion.”
    • Select the app from the search results and tap “Get” to download and install it.

2. Connect Your Computer and Mobile Device to the Same Wi-Fi Network

  • Ensure that both your computer and mobile device are connected to the same Wi-Fi network. This is crucial for establishing a successful connection between the two devices.

3. Open the MIT AI2 Companion App on Your Mobile Device

  • Locate the MIT AI2 Companion app on your device and tap to open it.
  • The app will display a screen with a QR code scanner and a text box for entering a code.

4. Connect to MIT App Inventor

  • On your computer, open the MIT App Inventor website and log in to your account.
  • In the App Inventor interface, click on the “Connect” menu at the top of the screen.
  • From the dropdown, select “AI Companion.”
  • A dialog box will appear displaying a unique QR code and a 6-character code.

5. Scan the QR Code or Enter the Code

  • Using the QR Code:

    • On your mobile device, tap the “Scan QR Code” button within the AI2 Companion app.
    • Align your device’s camera with the QR code displayed on your computer screen to scan it.
  • Entering the Code Manually:

    • If scanning the QR code is not possible, you can manually enter the 6-character code.
    • On your mobile device, tap the text box in the AI2 Companion app.
    • Enter the 6-character code displayed on your computer and tap “Connect.”

6. Wait for the Connection to Establish

  • After scanning the QR code or entering the code, wait a few moments for the connection to be established.
  • The AI2 Companion app will display a message indicating that it is connecting to the App Inventor server.

7. View and Test Your App on Your Mobile Device

  • Once connected, your app’s interface will appear on your mobile device through the AI2 Companion app.
  • You can now interact with your app in real-time, testing its features and functionality as you develop it in App Inventor.

Troubleshooting Tips

  • Ensure that both your computer and mobile device are connected to the same Wi-Fi network.
  • If the connection fails, try restarting the AI2 Companion app and repeating the steps.
  • Check for any firewall or network restrictions that might be blocking the connection.

By following these steps, you can seamlessly connect your mobile device to MIT App Inventor using the AI2 Companion app, allowing for efficient testing and development of your applications.

Congratulations! You’ve just created your first app with MIT App Inventor. This simple Text-to-Speech app demonstrates how you can bring your ideas to life with basic components and logic. Keep experimenting with different features and components in App Inventor to enhance your skills and create more complex apps. Happy coding!

× We're here to help!