Now that we have explored an example using cars, let’s focus on an example of developing an Android application. We are going to focus on software development because developing an Android application is developing software. While AppInventor will abstract many of the details of actual code away from us, many of the ideas you will work with will translate, almost directly, to what you would see in source code.
We are going to focus on the app, Android, Where’s My Car, which is fully described at: http://appinventor.mit.edu/explore/ai2/android-wheres-my-car.html. This is an excellent tutorial for getting started with Android app inventor and some of the sensors like the LocationSensor. We are approaching this app from the software development lifecycle.
Requirements Analysis: We decide that we want to create an Android application that can “bookmark” a location, say where we parked our car. Later, when we need to get back to our car, we select the bookmark and our phone tells us how to get to our car. At this point, we may want to story board our app. We could draw pictures (on the white board) of what our finished app should look like.
Design: Using our requirements and storyboard, we can determine the modules in our system. For our Android apps these modules correspond to components or items that users will interact with in your program. These components can be visible, like a button, or invisible, like a sensor.
You can determine the components you might need by walking through scenarios of usage. Asking questions can lead to some of the invisible components that you will need. For example, pressing the “Save Location” button might cause the user’s current location information to be stored. But stored where? That would lead us to the idea of using a database called TinyDB. How do we get the location? We should probably use a LocationSensor to help get our location.
For the design phase we are also interested in identifying the behaviors that the components might perform. These behaviors are the logic behind your program. You can annotate your storyboard to include invisible components and to list the types of behaviors the components might have. For example, pressing the “Save Location” button should pull the current location information from the LocationSensor and store it to the TinyDB for retrieval later. The key behavior in this scenario is the button press.
Development: Now that we know the components and behaviors that make up our app, we can start development. There are two main screens in AppInventor: 1) the Component Designer and 2) the Blocks Editor. The Component Designer is where we select and layout our components. The Blocks Editor is where we define the appropriate behavior(s) for each component. There is a lot of information to know about both of the interfaces, but we will leave that for you and your team to explore with the teaching staff. See the references and the summer camp website for resources to help you with AppInventor. The tutorial also lists the blocks for the Android, Where’s My Car? app.
Testing: Once our app is created, we need to test it to make sure it works. Your app will only work as well as you design it to work and your app requires extensive testing to ensure that you meet the requirements. One way to test our location app would be to load the app on the phone, set the current location to the lab, and then walk down the hall and have your app direct you back to the lab. If it does not work, you found a bug! Go back to development, fix, and repeat your test.
Deployment: Once you’re done with your app, it’s time to deploy it. You will want to package your app to file type of *.apk. The AppInventor site will package your app for you. You will then want to upload your app to some site where you have access (say Google sites, a public folder of DropBox, etc.). Create a QR code for the URL your app is at via the website: http://qrcode.kaywa.com/. You can then cut and paste the QR code image to your website, your poster, or other locations. Then others can try out your app!
Now, you need to think of the app that you want to write! Use a few pages to record the steps of the software development lifecycle to help you plan your app. Come up with the next viral Android app.
Now let’s go through these stages to create your own mobile app!