FTC Training Manual: Running App Inventor Locally For Windows Pcs
FTC Training Manual: Running App Inventor Locally For Windows Pcs
FTC Training Manual: Running App Inventor Locally For Windows Pcs
Thomas Eng
9/10/2015
This document contains training material to introduce students and mentors to the next gen FIRST Tech
Challenge robot controller platform.
DRAFT: Contents Subject to Change
Contents
1 Introduction .......................................................................................................................................... 2
2 Installing App Inventor Locally on a Windows Computer ..................................................................... 3
2.1 Installing Google Chrome .............................................................................................................. 3
2.2 Downloading VirtualBox ............................................................................................................... 3
2.3 Running the VirtualBox Installer ................................................................................................... 4
2.4 Verifying Custom Setup Features.................................................................................................. 4
2.5 Verify Custom Setup Options ........................................................................................................ 5
2.6 Network Interfaces Warning ......................................................................................................... 6
2.7 Ready to Install.............................................................................................................................. 6
2.8 Installing Device Software............................................................................................................. 7
2.9 Installation Complete! .................................................................................................................. 7
2.10 Configuring VirtualBox .................................................................................................................. 8
2.10.1 Configuring the Network Preferences .................................................................................. 8
2.10.2 Verify the Network Settings .................................................................................................. 9
2.11 Installing the Appliance............................................................................................................... 11
2.12 Start the Appliance ..................................................................................................................... 14
2.13 Accessing the App Inventor from your Local Computer ............................................................. 16
2.14 Shutting Down the App Inventor Appliance ............................................................................... 18
3 Let’s Build an App! .............................................................................................................................. 19
3.1 Navigating the Designer Mode Screen ....................................................................................... 19
3.2 Creating Our User Interface ........................................................................................................ 24
3.3 Programming in Block Mode....................................................................................................... 28
3.4 Building Your App........................................................................................................................ 35
3.4.1 A Note Regarding App Inventor Local and Using a QR Code .............................................. 35
3.4.2 Using a USB Cable to Install Your App................................................................................. 36
FTC_AppInventor_Local_win_v0_08 Page 1 of 42
DRAFT: Contents Subject to Change
1 Introduction
The App Inventor is a design tool that makes it easy for you to create your own Android apps using a
very user-friendly drag-and-drop, visual interface. In order to customize the behavior for your robot,
you will need to use the App Inventor to create a Robot Controller app with one or more op modes that
you can use to control your robot.
Figure 1 - The App Inventor is a browser-based application that makes it easy to create custom Android apps.
The App Inventor is a browser-based application. This means that you run the application using a web
browser such as Google Chrome, Apple Safari, or Mozilla Firefox. The App Inventor is normally available
as a web site run by MIT. This means that you typically need to be connected to the Internet in order to
use App Inventor.
However, for the FIRST Tech Challenge (FTC) competitions teams might not always have access to the
Internet at competition venues. This document teaches you how to install and run App Inventor for FTC
on a computer so that it can be used offline without an Internet connection.
The App Inventor application will run in an Appliance, which is another way of saying that it will run in a
Virtual Machine. The appliance is a virtual server running on your computer. This virtual server is
preconfigured with all of the software that is needed to run App Inventor. Your personal computer will
“talk” to this virtual server through a virtual (“host only”) network connection. Your personal computer
will access the App Inventor application through this virtual server.
Important Note: Although the App Inventor virtual server can run locally without an Internet
connection, you will need an Internet connection (or have the software copied on a flash drive) to install
and configure the local copy of App Inventor.
FTC_AppInventor_Local_win_v0_08 Page 2 of 42
DRAFT: Contents Subject to Change
The Chrome web browser is available for free from Google. Visit the Chrome website
(http://www.google.com/chrome) and follow the site’s instructions to download and install Google
Chrome onto your Windows PC.
https://www.virtualbox.org/wiki/Downloads
You will want to download the “VirtualBox … for Windows hosts” package.
FTC_AppInventor_Local_win_v0_08 Page 3 of 42
DRAFT: Contents Subject to Change
FTC_AppInventor_Local_win_v0_08 Page 4 of 42
DRAFT: Contents Subject to Change
Figure 4 - Verify that your Custom Setup Options look like the ones depicted here.
Figure 5 - Verify that the "Register file associations" option is selected and hit Next.
FTC_AppInventor_Local_win_v0_08 Page 5 of 42
DRAFT: Contents Subject to Change
FTC_AppInventor_Local_win_v0_08 Page 6 of 42
DRAFT: Contents Subject to Change
Figure 7 - Your computer might prompt you several times to install device software. Click Install for each prompt.
FTC_AppInventor_Local_win_v0_08 Page 7 of 42
DRAFT: Contents Subject to Change
FTC_AppInventor_Local_win_v0_08 Page 8 of 42
DRAFT: Contents Subject to Change
Click on the "Host-only Networks" tab, and make sure that the VirtualBox Host-Only Ethernet Adapter
appears. If it does not, click the "Add host-only network" button, and one should appear. If the
computer prompts you to "allow changes", click Yes.
Figure 9 - Verify that a "VirtualBox Host-Only Ethernet Adapter" is present. If not, add one.
FTC_AppInventor_Local_win_v0_08 Page 9 of 42
DRAFT: Contents Subject to Change
Click the Adapter tab of the Host-only Network Details window, and make sure that the text fields are
as follows:
IPv6 Address:
Then, click the DHCP Server tab, and make sure the settings are as follows:
FTC_AppInventor_Local_win_v0_08 Page 10 of 42
DRAFT: Contents Subject to Change
ServerAddress: 192.168.56.100
FTC_AppInventor_Local_win_v0_08 Page 11 of 42
DRAFT: Contents Subject to Change
The appliance file is the file that contains the image of the virtual App Inventor server. The image file is
available on an FTC App Inventor download page. You can access the FTC App Inventor download page
using the following link (click on the button labeled “App Inventor (Windows)”):
http://frc-events.usfirst.org/2015/ftcimages
Also note that this file is large (approximately 2 GB). Depending on the speed of your Internet
connection, it might take a while to download.
Once the file has downloaded, click File -> Import Appliance.
When the "Appliance to Import" window appears, click the button to "Choose a virtual appliance to
import", and navigate to where the appliance was downloaded (typically in the Downloads folder).
When you have selected the .ova file, click open. Then back in the "Appliance to import", click Next.
FTC_AppInventor_Local_win_v0_08 Page 12 of 42
DRAFT: Contents Subject to Change
Figure 15 - Click on the folder icon to browse for the downloaded appliance file.
A window with "Appliance Settings" should appear with information about the appliance. Note that the
values that are displayed on your windows might differ slightly from the values shown in the figure
below. Just click Import.
A window will then pop up showing the progress as it imports the appliance. Just wait until it has
finished.
FTC_AppInventor_Local_win_v0_08 Page 13 of 42
DRAFT: Contents Subject to Change
Figure 18 - Select the App Inventor appliance and hit the Start button.
As your appliance is booting up a new window will appear. This window will eventually display the
virtual desktop for the App Inventor server. You can use this window to interact with the virtual server.
FTC_AppInventor_Local_win_v0_08 Page 14 of 42
DRAFT: Contents Subject to Change
Figure 19 - A new window should appear. This Window will be the desktop interface to your virtual server.
The virtual server’s desktop looks like an ordinary Linux user interface, except it is running within the
VirtualBox window. The virtual server’s desktop displays three important pieces of information, the App
Inventor server IP address, the App Inventor server status, and the build server status. You will need to
know the App Inventor server’s IP address in order to be able to run the application. Also, it is
convenient to be able to check on the App Inventor server’s status and the build server’s status. If a
server’s status reads “Server:XXX” instead of “Server:ok”, then you might need to wait a few moments
until the server has finished loading.
Figure 20 - The virtual desktop displays important info (IP address, App Inventor server status and build server status).
FTC_AppInventor_Local_win_v0_08 Page 15 of 42
DRAFT: Contents Subject to Change
Note that your virtual server has a password protect user account. If your virtual desktop is inactive for
a while, the screen saver lock will appear on the virtual desktop. If you are prompted to unlock the
device, use “ftc” as the user password.
Figure 21 - If prompted use the password "ftc" to unlock the virtual desktop.
In your browser window, type "http://192.168.56.35:8888", and hit the Enter key.
FTC_AppInventor_Local_win_v0_08 Page 16 of 42
DRAFT: Contents Subject to Change
Figure 22 - Type "http://192.168.56.35:8888" into your browser and hit the Enter key.
When you first connect to the app inventor server, it will prompt you to login. You do not have to
specify your e-mail. You can accept the default e-mail (“test@example.com”) and click on Log In to
launch the App Inventor. Note that your user profile and list of projects will be associated with
whatever e-mail address you use to log in. You can use the default e-mail account
(“test@example.com”) or login with a different address.
Figure 23 - Hit the Log In button to start using App Inventor locally.
FTC_AppInventor_Local_win_v0_08 Page 17 of 42
DRAFT: Contents Subject to Change
If a window pops up asking you to accept the Terms and Conditions, click Accept, and it should bring
you to the screen below.
Figure 24 - Congratulations! You did it! You're able to run App Inventor locally!
Congratulations! You did it! You’re now able to run App Inventor locally. When you have completed
the design of your app, you can build the app and download it as a .apk file onto your local Windows
computer’s hard drive. You can then use a USB cable to transfer the file to your Android device and to
install and run the app on your Android device.
FTC_AppInventor_Local_win_v0_08 Page 18 of 42
DRAFT: Contents Subject to Change
Figure 25 - Press the menu icon (see #1) and then press the power button (see #2) to shut down the virtual server.
A window should appear with a button labeled “Shut Down” on it. Press the “Shut Down” to turn off
your virtual server. If you need to start the appliance again, simply follow the instructions in section
2.12 to restart the virtual server.
Let’s begin by creating an App Inventor project. On the welcome screen, press the “Start new project”
button located near the upper left hand side of the screen.
FTC_AppInventor_Local_win_v0_08 Page 19 of 42
DRAFT: Contents Subject to Change
Figure 26 - Click on the "Start new project" button to create your first project.
The App Inventor server should prompt you for a project name. Specify a project name and hit “OK” to
create a new project.
Figure 27 - Specify a project name and hit "OK" to create a new project.
Your web browser should open your newly created project in Designer mode. Designer mode is the
mode of the application where you visually create your Android app using a drag-and-drop visual editor.
FTC_AppInventor_Local_win_v0_08 Page 20 of 42
DRAFT: Contents Subject to Change
Let’s take a look at your screen for a moment. There are several App Inventor menu items listed along
the top portion of the screen. We will use these menu items to open and close our projects and to build
our apps for installation onto our Android device.
Figure 29 - App Inventor menu items are available along the top of the screen.
On the left hand side of the App Inventor Designer mode screen there is a palette of tools that you can
use to add design elements (widgets) to your app’s screen (also known as an activity).
FTC_AppInventor_Local_win_v0_08 Page 21 of 42
DRAFT: Contents Subject to Change
Figure 30 – Several categorized palettes of design elements are available on the left hand side of the screen.
Towards the center of the screen, there is the Viewer pane. In this area of the screen, there is a visual
representation of the app’s screen or activity. As you design your app, you will drag design elements
(such as a button or textbox) from the palette and place them on the screen/activity in the Viewer pane.
FTC_AppInventor_Local_win_v0_08 Page 22 of 42
DRAFT: Contents Subject to Change
The Components pane displays a hierarchical view of the components that make up your app. In the
screen shot below, there is only one component listed (“Screen1”). You can select a component and
rename it from this pane. You can also select and delete components using this pane.
Figure 32 - The components that make up your app are displayed in a hierarchical fashion in the Components pane.
Any component that is selected in the Components pane will have detailed information about the
component appear in the Properties pane. This pane shows the properties for the selected component.
You can review and edit these properties using this pane.
FTC_AppInventor_Local_win_v0_08 Page 23 of 42
DRAFT: Contents Subject to Change
Figure 33 - You can review and edit the properties of a selected component in the Properties pane.
FTC_AppInventor_Local_win_v0_08 Page 24 of 42
DRAFT: Contents Subject to Change
Figure 34 - Use your mouse to select and drag a Button element from Palette to Screen1.
After you have successfully placed a button onto the main screen of the Viewer pane, you should see
that there is an element called “Button1” that appears as part of “Screen1” in the Components pane of
App Inventor. If you select the “Button1” object in the Components pane, the properties for the
“Button1” object will appear in the Properties pane on the right hand side of your web browser.
Let’s rename our button component. In the Components pane, click on the “Button1” object to select it,
then hit the “Rename” button.
FTC_AppInventor_Local_win_v0_08 Page 25 of 42
DRAFT: Contents Subject to Change
A dialog box should appear prompting you to rename the selected component. Specify a new name of
“btnHello” and press the “OK” button to rename your component.
Figure 36 - Rename your component to "btnHello" and press "OK" to accept the change.
After you have renamed the button, let’s use the Properties pane to change the text that appears on the
face of the button. In the Properties pane, towards the bottom of the pane, there should be a text box
labeled “Text” with a default value of “Text for Button1” in the box. Highlight the “Text for Button1”
using your mouse and then type in the word “Hello” as the replacement text. You can press the Return
key on your keyboard or click an area outside of the text box to commit your change.
FTC_AppInventor_Local_win_v0_08 Page 26 of 42
DRAFT: Contents Subject to Change
Once your change has been committed, the button in the Viewer pane should now be labeled with the
word “Hello”.
Figure 39 - The button text should now read "Hello" in the Viewer pane.
Now that we have successfully added a button to our user interface, let’s add one more additional
design element. We are going to add a “non-visible” element to our main screen or activity. We will
drag this element from the User Interface Palette and drop it onto our screen in the Viewer pane.
However, this element will not be visible to the user when they run the app. It is a non-visible
component that will be used by the app, but will be hidden from view from the user during runtime.
Use your mouse to select and drag a Notifier component from the User Interface Palette to the Viewer.
Figure 40 - Drag a Notifier element from the Palette to your app's screen in the Viewer pane.
The Notifier object will appear as “Notifier1” at the bottom of the Viewer pane.
FTC_AppInventor_Local_win_v0_08 Page 27 of 42
DRAFT: Contents Subject to Change
Figure 41 – Notifier1 should appear at the bottom of the Viewer pane as a "Non-visible" component.
If you view Notifier1’s properties in the Properties pane, you’ll notice that it has three properties:
BackgroundColor, NotifierLength and TextColor. We will leave the default values for these properties.
Note that the NotifierLength determines how long our message will be displayed on the screen. We
would like this message to be visible for a long time, so we want to make sure the NotifierLength is set
to “Long” in the Properties pane.
Figure 42 – NotifierLength determines how long our message will be visible to the user.
Now that we’ve placed the Notifier component onto our app activity, we are ready to switch from
Designer mode and into Blocks mode.
FTC_AppInventor_Local_win_v0_08 Page 28 of 42
DRAFT: Contents Subject to Change
We used the Designer interface to design the user interface for our app. Now we need to use the block
programming mode to program some logic behind our user interface. The App Inventor uses a Blockly
style programming model to let you visually program the logic for your app.
Figure 44 – The “Blocks” mode lets you create the program logic for your app.
Take a look at the programming mode screen. On the left hand side you have a panel or pane that
contains categorized program blocks that you can use for your app.
FTC_AppInventor_Local_win_v0_08 Page 29 of 42
DRAFT: Contents Subject to Change
Figure 45 - The left hand pane has a list of categorized built-in and component-specific programming blocks.
You can click on any of the categorized items in the Blocks pane and a screen with available
programming blocks will appear. You can drag these blocks onto the Viewer pane to create the
programming logic for your app.
Figure 46 - You will assemble your programming blocks in the Viewer pane to create the logic for your app.
Before we begin programming our app, let’s think about what we would like our app to do. Our app will
be a very simple one. Whenever a user presses or “clicks” onto our Hello button, we would like to
FTC_AppInventor_Local_win_v0_08 Page 30 of 42
DRAFT: Contents Subject to Change
display a simple message (using the Notifier1 component) to the user. Let’s see how we can do this with
the App Inventor.
In “Blocks” pane of your programming area, click on the “btnHello” component (which should be visible
under the “Screen1” component) to display a list of programming blocks that are associated with that
component.
Figure 47 - Click on the "btnHello" component to display the programming blocks associated with this object.
From the list of programming blocks, select the block that has the text “when btnHello.Click” on it and
place it to the Viewer screen.
This programming block represents the action that occurs when the user clicks on the “btnHello”
button. We are going to use this block to tell our app what to do when this button is clicked. We want
FTC_AppInventor_Local_win_v0_08 Page 31 of 42
DRAFT: Contents Subject to Change
to tell our app to use the Notifier component (called “Notifier1” in our app) to display a message (also
known as a “toast”) on the screen.
Click on the “Notifier1” object in the Blocks pane to display the programming blocks that are associated
with this component.
When the list of programming blocks appears, scroll down towards the center of the list and look for the
block with the text “call Notifier1.ShowAlert” on it. We are going to use this programming block to
show an alert message (also known as a toast) on the user screen when the Hello button has been
clicked.
Figure 50 - Scroll down towards the middle of the list and select the "call Notifier1.ShowAlert" programming block.
FTC_AppInventor_Local_win_v0_08 Page 32 of 42
DRAFT: Contents Subject to Change
Select the “call Notifier1.ShowAlert” programming block and drag it so that you can place this
programming block inside the “when btnHello.Click” programming block. Notice that the exterior shape
of the “call Notifier1.ShowAlert” programming block matches the shape of the “when btnHello.Click”
cutout near the word “do”. Also note that when you place the “call Notifier1.ShowAlert” block near the
“do” cutout, the “call Notifier1.ShowAlert” block gets outlined in yellow and it matches the highlighted
yellow tab on the “when btnHello.Click” block.
Figure 51 - Place the "call Notfier1.ShowAlert" block into the match space of the other programming block.
Once you have placed the Notfier1 block into the btnHello block, the two should interlock like pieces of
a puzzle. Let’s take a look at our programming logic for our app so far. When a user clicks on the Hello
button, the app will display an alert message to the user. Now we have to specify what message or
“notice” we want to display.
Figure 52 - When a user clicks on the Hello button, the app will display an alert message to the user.
FTC_AppInventor_Local_win_v0_08 Page 33 of 42
DRAFT: Contents Subject to Change
The last thing we need to do is to specify the text string that will be displayed in the alert message.
From the Blocks plane, select the “Text” item from the list to display the text-related programming
blocks.
Find the programming block labeled with the quotation marks (see ) and drag this block and interlock it
to the “notice” side of the “call Notifier1.ShowAlert” programming block.
Figure 54 – Select the double quotation mark block and connect it to the Notifier1.ShowAlert block.
Once the blocks interlock, click on the text box in between the quotation marks and type in the phrase
“Hello World!”.
Figure 55 –Type in the phrase “Hello World!” in between the quotation marks.
FTC_AppInventor_Local_win_v0_08 Page 34 of 42
DRAFT: Contents Subject to Change
Let’s review the programming logic… when a user clicks on the btnHello component, the app will call the
ShowAlert method of the Notifier1 component to display a text string with the phrase “Hello World!” to
the user.
Building your app is a very simple process. You simply select a menu item from the App Inventor
console and the App Inventor server does all of the work. You will then transfer the .apk file to your
Android device after the app has been created.
Figure 56 - An Android device will not be able to access the .apk file using a QR code for the local App Inventor.
FTC_AppInventor_Local_win_v0_08 Page 35 of 42
DRAFT: Contents Subject to Change
A progress bar should be displayed on the screen as the build server builds the app. It may take a few
minutes to complete the build.
Once the .apk has been built, it should automatically be downloaded to your computer.
FTC_AppInventor_Local_win_v0_08 Page 36 of 42
DRAFT: Contents Subject to Change
Use your laptop’s file explorer to locate the app on your laptop.
Figure 60 - Use your computer's file browser to locate the .apk file.
Now that your .apk file has been built and downloaded, you will need to transfer it to your Android
device. If you are using a ZTE Speed phone, start by connecting the computer to the phone using a USB
cable.
FTC_AppInventor_Local_win_v0_08 Page 37 of 42
DRAFT: Contents Subject to Change
Once you have connected the ZTE Speed to your computer, you want to check to make sure your phone
is in Media Device mode. To check if your phone is in Media Device mode, use your finger to slide down
from the top of the home screen to access the USB options menu.
Figure 62 - Touch the top of the screen and slide down to access the USB options menu.
Touch the “Touch for other USB options” item launch the USB options menu. In the USB options menu,
you want to make sure your phone is in “Media device (MTP)” mode. This means that your phone will
look like a USB media device (such as a USB thumb drive) to your computer.
FTC_AppInventor_Local_win_v0_08 Page 38 of 42
DRAFT: Contents Subject to Change
Your phone should look like a media device in your computer’s file browser. Copy and paste the .apk
file your PC to the Download directory of your Android device.
Figure 64 - Copy and paste the .apk file to the Download directory of your ZTE Speed phone.
Once you have the .apk file copied to your phone, you want to use the phone’s File Manager to find the
file on your phone and to install it. Go to the Apps listing on your ZTE Speed phone and look for the app
named “File Manager”.
Figure 65 - Launch the File Manager so you can browse for the .apk file.
Use the File Manager app to locate the .apk file in the Download directory of your ZTE Speed phone.
You need to click on the PHONE tab at the top of the File Browser app and then look for the Download
folder. Click on the Download folder to open it. You should see the SimpleApp.apk file within the
folder. Click on the .apk file to install it.
FTC_AppInventor_Local_win_v0_08 Page 39 of 42
DRAFT: Contents Subject to Change
Figure 66 - Use the File Manager to locate the .apk. Click on the .apk file to install it.
Depending on your security settings, your ZTE Speed phone might display a security warning, indicating
that the app installation was blocked since the app was not downloaded through the Google Play store.
Click on the “Settings” button to display the Security settings. Make sure the “Unknown sources” option
is selected for your phone.
Figure 67 - Go to the Security Settings menu and make sure the "Unknown sources" option is checked.
Once you have verified that your security settings allow for the installation of apps from “Unknown
sources” use your back arrow to return to the install screen. Android should prompt you to make sure
you would like to install the app onto your phone. Hit the “Install” button to start the installation.
FTC_AppInventor_Local_win_v0_08 Page 40 of 42
DRAFT: Contents Subject to Change
Click on the “Open” button to launch the app, once the installation is complete.
Once the app is launched, press the “Hello” button to display the notification.
FTC_AppInventor_Local_win_v0_08 Page 41 of 42
DRAFT: Contents Subject to Change
Congratulations! You just built an app and transferred it to your device using a USB cable!
FTC_AppInventor_Local_win_v0_08 Page 42 of 42