Coding Club
Mobile apps with App Inventor
Six apps for phones and tablets, built in MIT App Inventor, a free tool that runs in your browser. You design each screen by dragging buttons and labels onto a phone, make it work by snapping blocks together, and test it on a real phone with the free Companion app.
Six days, six projects
One small project a session. Each one is a numbered list of steps with a picture of what to click and what you should see, then tests and stretch challenges for anyone who finishes early.
Get set up before day 1
You will need
- A computer with a web browser
- A Google account, or an App Inventor revisit code
- An Android phone or tablet, or an iPhone or iPad, with the free MIT AI2 Companion app
- The phone and the computer on the same WiFi
Setup step 1: Open App Inventor
Go to ai2.appinventor.mit.edu and sign in with a Google account, such as your school one.
No Google account? Go to code.appinventor.mit.edu and choose Continue Without An Account. App Inventor gives you a revisit code: write it down somewhere safe, because it is the only way back to your projects.
Setup step 2: Start a new project
Click Projects, then Start new project. Type a name with no spaces, such as
TalkBack, and click OK.App InventorMy projectsStart new projectImport project (.aia) from my computerImport project (.aia) from a repositoryDelete ProjectMove To TrashSave projectSave project as...CheckpointExport selected project (.aia) to my computerProjects, then Start new project. App InventorCreate new App Inventor projectTalkBackCancelOKType a name with no spaces (1), then OK (2). Setup step 3: The Designer
A new project opens in the Designer, where you design how the app looks.
- The Palette holds the components: buttons, labels, pictures, sensors and more.
- The Viewer shows the phone's screen. Drag components from the Palette onto it.
- Components lists everything in your app. Click one to choose it.
- Properties are the settings of the chosen component, such as its text, size and colour.
App InventorMy ProjectsGuidePaletteSearch Components...User InterfaceButton?CheckBox?DatePicker?Image?Label?ListPicker?ListView?Notifier?PasswordTextBox?Slider?Spinner?Switch?TextBox?TimePicker?WebViewer?LayoutMediaDrawing and AnimationMapsSensorsSocialStorageConnectivityLEGO® MINDSTORMS®ExperimentalExtensionViewerDisplay hidden components in Viewer9:41Screen1ComponentsScreen1RenameDeletePropertiesScreen1 (Screen)AboutScreenAccentColorDefaultAlignHorizontalLeft : 1AlignVerticalTop : 1AppNameTalkBackBackgroundColorDefaultIconNone...PrimaryColorDefaultScreenOrientationUnspecifiedSizingResponsiveThemeDevice DefaultTitleScreen1TitleVisibleThe Designer's four parts: Palette, Viewer, Components and Properties. Setup step 4: The Blocks editor
Click Blocks at the top right to switch to the Blocks editor, where you make the app work. The drawers on the left hold the blocks: drawers for maths, text, lists and more at the top, and a drawer for each component in your app. Click a drawer, then drag a block into the space on the right. Designer takes you back.
App InventorMy ProjectsGuideBlocksBuilt-inControlLogicMathTextListsDictionariesColorsVariablesProceduresScreen1Any componentRenameDeleteShow WarningsClick Blocks to switch to the Blocks editor. Setup step 5: Get the Companion app
To try your app on a phone or tablet, install the free MIT AI2 Companion app from the Google Play Store (Android) or the App Store (iPhone and iPad).
9:41MIT AI2 CompanionSix Character Codeconnect with codeorscan QR codeThe MIT AI2 Companion app, ready to connect. Setup step 6: Connect your phone
In App Inventor, click Connect, then AI Companion. A box appears with a QR code and a six letter code. Open the Companion app on your phone and tap scan QR code, or type the six letters and tap connect with code. Your app appears on the phone, and from now on it changes the moment you change it on the computer.
App InventorAI CompanionEmulatorUSBRefresh Companion ScreenReset ConnectionHard ResetConnect, then AI Companion. App InventorConnect to CompanionLaunch the MIT AI2 Companion on your device and then scan the barcode or type in the code to connect for live testing of your app.
Your code is: gdmrfaCancelScan this code with the Companion, or type the six letters. 9:41MIT AI2 Companiongdmrfaconnect with codeorscan QR codeType the code and tap connect with code, or scan the QR code. Watch out The phone and the computer must be on the same WiFi network. If the school's network blocks it, ask your teacher about the emulator or a USB cable, under the same Connect menu.Setup step 7: Your work saves itself
App Inventor saves your project as you work. To keep a copy of your own, click Projects, then Export selected project (.aia) to my computer. On Android, Build makes an app you can install and keep on the phone.
App InventorMy projectsStart new projectImport project (.aia) from my computerImport project (.aia) from a repositoryDelete ProjectMove To TrashSave projectSave project as...CheckpointExport selected project (.aia) to my computerExport selected project keeps a copy on your computer.
Notes for the teacher
Before the first session
- Open ai2.appinventor.mit.edu on a club computer to check the school's filter allows it.
- Decide on accounts. Students can sign in with a Google account, such as a school Google Workspace account. Students without one can use Continue Without An Account at code.appinventor.mit.edu, which gives each of them a revisit code. Keep a copy of every code: a lost code means lost projects.
- Phones or tablets need the free MIT AI2 Companion app, and must be on the same WiFi as the computers. School networks sometimes block the connection: test one device first. If they do, the emulator (Connect, then Emulator) works on Windows after installing aiStarter.
- One phone between two or three students is enough, since apps are tested in short bursts.
How the six projects build up
Day 1 introduces the Designer, events and the Companion. Day 2 adds random numbers and if then else, day 3 event parameters and drawing, day 4 lists, global variables and procedures, day 5 sensors and refactoring, and day 6 animation and a timer in a game.