AppInventor:Advanced Tutorials

From Notes

Jump to: navigation, search

Now that you are feeling more comfortable with using and creating with App Inventor, you should study and try these tutorials that will allow you to create more complex web applications by utilizing components such as the GPS, TinyWeb Database, and Activity Starter.

At this point, the best way to learn is by studying other applications that have components you would like to use. Take screen shots of their code for future use in your own application and alter it to fit your own needs. Good luck!

Contents

Using the Location Sensor Component

The "location sensor" component allows you to create applications that utilize the Andorid phone's GPS capabilities. With this you can call functions that will find your current location (latitude and longitude) and can compare that with the known lat, and lon. coordinates for a destination of your choosing. This is an advanced feature that could have many applications. Here are a few examples of how some people decided to use the location sensor. We also made an advanced application of our Trinity App by using the Location Sensor to allow users to click a button and be shown where they currently are on campus.

  • Here is an application that uses the Location Sensor (i.e. GPS) in order to tell you how far you are from a designated destination.

File:GPSexample.zip

  • Here is another application that uses the location sensor. This one is a bit more complicated and also uses the WebDB component, but it is very useful I think. It automatically texts a message of your creation to a person from your contacts when you are within a designated range from your destination. Here is the .zip file you can upload to you App Inventor account. Check it out!

File:HarvardExample.zip

Using the TinyWeb DB Component

Databases are an important component in web applications. You will need a database in order to store and retrieve data. Incorporating this feature will take your application to the next level.

Google provides a web database that holds a maximum of 100 entries, which can be used to test, but you will want to create your own private version of their database for your own application. The google database... which is the default url for the "tinywebdb" feature on App Inventor can be found here: http://appinvtinywebdb.appspot.com/

Once you have tested your application's database capabilities using the default web database, you should create your own.

Here is a great tutorial that will show you how to create your own database, identical to the one on Google. Most of the hard manual labor in creating a web database comes with all of the installations you have to do. But once you have all of the appropriate programs needed, creating the database takes a matter of minutes. In addition to the pdf file below, you will also need to download Notepad++. You can do this by going to www.sourceforge.net then search for Notepad++ and download it. Don't forget to download the file below to get started on creating your own web database!
File:WebDBTutorial.pdf

  • In order to personalize the database with your own words, picture, etc you must open the main.py file through Notepad++. After you are done making changes save the file and deploy the new file using the Google App Engine.

After using the TinyWeb DB you may notice that you can only store one value under each tag, so in order to store more than one value under the same tag you can use a method that splits the entries at a character or space, then stores them in a list, and from that list you can manipulate the individual values.

  • Here is code example for a way to split a database value at a comma.

http://sites.google.com/site/cs114wellesley/Labs/lab12

You can also look at the code in Mall Madness to see how we split the value at a space and how you can then manipulate that data to add points and such. AppInventor: Mall Madness

Using the Activity Starter Component

The "Activity Starter" component can be used to start another application on your Google Droid phone. So, for example, you can have a button on your application that will open your "Google Maps" application when opened with a set location already targeted. This could perhaps be used as a way to enable people to get directions to a certain location you were describing in your previous application. the only problem is that, once you start another application, you are working in another application, and are no longer able to access your previous application from the new application you are currently in. Perhaps this feature can be used to link your own App Inventor applications in an effort to have more than one screen. You would, of course have to have the applications already installed on your phone before being able to use the feature... but it could prove fruitful...

In order to find the Action, Activity Package, and Activity Class for the application you want to open, you simply have to download and unzip the Android SDK found here: (http://developer.android.com/sdk/index.html) and connect your Droid phone to you computer. Then you open the ddms.bat file which will show you a log of the activity on your phone. With this you will be able to find the necessary information needed and described in the tutorial below.

  • Here is a site which contains a mini tutorial on how to use "activity starter":

http://sites.google.com/site/appinventorhelp/sample-apps/examples-using-activitystarter

  • Here is an application that uses the activity starter. You could use it as a template, or to stimulate ideas.

File:StarterExample.zip

Using the Text to Speech/Voice Recognition Components

In order to make this feature functional on your phone, you need to first go to the marketplace and install the "TTS Service Extended" application if you have not done so already.

The Text to Speech component enables you or the user to input text and have the phone speak it. The Voice Recognition component allows the phone to interpret speech on the part of the user. You can then use the Text to Speech component to convert the speech into text that can then be spoken back to the user as speech (on the part of the phone).

It is a very versatile component that allows you to make any application more interactive and fun. We used these components in our Work It Off application to allow users to speak a food, which was then converted into text, and that text was used in the program to retrieve the caloric value for that text (the food) from the database. Very useful, and fun... because the computer interprets what you say in the most peculiar ways at times... Try it out!

  • Here is an application that uses both the text to speech and voice recognition components to convert what the user says into text that the phone can then speak. I like this application because it is not only fun, but relatively simple.

The link below leads to the "Telephone Game" tutorial. Try it out!

http://sites.google.com/site/appinventorhelp/sample-apps/telephone-game

Check It Out!

Google is not only upgrading it's platform as we speak, they have also created a new tutorials page with greater accuracy and detail. They have new features in this tutorial that includes a better blocks reference, a troubleshoot page, and a Google group so you can talk to other App Inventors. Check it out! Well... check it out once they're finished working on it....

http://appinventor.googlelabs.com/learn/

More Example Applications

After you have a feel for how to use these more advanced features, you should be well on your way to creating a fully functional complex web application! It is very helpful to have an arsenal of applications from which to gain ideas and coding examples. Therefore, I am providing some links to pages that contain applications from which to stimulate the senses. The links below are from google pages, but if you search for App Inventor applications on your own, you can easily find schools and other App Inventor users who have uploaded their applications onto the web for your enjoyment.

You should be ready to create on your own now. Happy Inventing!!!

Make Quiz Take Quiz: http://appinventor.googlelabs.com/learn/tutorials/makequiztakequiz/makequiztakequiz.html


http://code.google.com/p/app-inventor-for-android-cs0projects/downloads/list

http://sites.google.com/site/appinventorhelp/sample-apps/code-examples

http://sites.google.com/site/pncportfolio/original_projects/classboard

http://appinventor.googlelabs.com/learn/gallery.html


Back To Main Page
Personal tools
NSF K-12