USF students create App-Inventor-Compatible Yelp API


App Inventor provides a component, TinyWebDB, which can be used to talk to web data sources (APIs) that follow a specific protocol. You can use APIs bring in book data from Amazon, stock information from Yahoo Finance, and data from blogs (see appinventorapi.com for samples) There’s also a new Web component in App Inventor that provides another method for talking to APIs.

Last semester, Jackie Tong, a University of San Francisco student taking our App Inventor course, created an”App-Inventor-Compatible” API to Yelp’s recommendation data. The API gives access to simple search on Yelp.

You can access Jackie’s API directly from your App Inventor apps. Just add a TinyWebDB component and set the sourceURL to cs1072spr11.appspot.com.

 

You can also download the source code to modify it and add new Yelp commands. She wrote the code in Python and using App Engine, and she’s been kind enough to share the code at:

http://www.cs.usfca.edu/~wolber/appinventor/yelpTinyWebDBJackie.zip

Jackie was a beginning computer science student. She is exceptional, but her work shows that even beginners can create APIs using Python and App Engine, and thus, with App Inventor, can create web enabled Android apps.

App Inventor has a new Component: the WEB

The App Inventor team just released a new component, and its a whopper: the WEB. Before this component, you had to create and deploy server code, using Python, Java, etc,  in order for your app to get data from the web. Now you can call APIs directly from your App Inventor blocks!  Suddenly, App Inventor programmers have a lot more power to create web-enabled apps that mash data from various sources.

As a first example, check out this App Inventor app that accesses stock quotes from the Yahoo Finance API:

stock quote app in emulator

Designer view for stock quote app

The blocks for stock quote app (click to enlarge)

The app just sets the Web component’s Url property to the base URL of Yahoo Finance, then adds on the stock symbol input by the user in the StockSymbolTextBox.

The call to Web1.Get then invokes the web request. The event Web1.GotText is triggered when the data arrives back from the Yahoo Finance. The data, in this case the stock info in comma-separated form, is returned in the argument responseContent. The app uses the list function listfromcsvrow to get the csv values into list form, then grabs the second item which is the stock’s current value.

The Yahoo Finance API is especially easy to use because it doesn’t require any password or key. You can get different information out, such as the one-day change in the stock, and you can send different parameters in the URL to ask for different data. Check out this site for a nice spec of the Yahoo Finance API.

There are lots of APIs out there, some of which have simple interfaces like Yahoo Finance, and some which require more work. I’ll be exploring more of these in future posts.

This app is a simple one, but if you want to download it to your phone, just scan the following QR code:

Building an Amazon Client with App Inventor

I just updated a sample of “Amazon in the Bookstore”, an App Inventor app that lets you search Amazon books by keyword or ISBN. The update even lets you scan a book to get its Amazon information (including lowest price!).

The app demonstrates how App Inventor can be used to create apps that talk to web services (APIs). For those of you that know some Python programming, or know a Python programmer, you can also download the source code of the web service itself. It provides a good example of how to create an App-Inventor-compliant web service.

For more information and to download the sample app and its source code, see:

http://appinventor.org/amazon-at-the-bookstore.

On App Inventor and Lowering the Bar

Steve Lohr of the New York Times calls it Do-It-Yourself App Creation Software. Salon’s Dan Gillmor says it is the Hypercard for mobile development. Others have put it in a more recent context by calling it Scratch for App Development. Mike Loukides of O’Reilly wrote:

This is revolutionary; they’re not trying to lower the bar, they’re throwing it away entirely.

I’ve taught App Inventor to non-programmers for a year as part of Google’s pilot program and I can say from experience that these guys are right: App Inventor will change both how apps are created, and who creates them.

Will the bar be thrown away? Not exactly, but a lot more people can get under the bar– and past the syntax barrier that has forever kept them out– to enter the app building world. Once in there are still difficult logical and design mountains to climb, but by then your hooked. Its like the barriers to learning simple conversational French have been eliminated, so that you can immediately chat with that French woman you meet at the bar. To get the girl you have to be smart and speak some poetry at some point, but now you’re motivated, a hell of a lot more motivated than if you had to go back to Cleveland and spend a year learning how to say, “Souhaitez-vous un verre de vin”

I see App Inventor creation at three levels:

Level 0, Anyone: some simple but very useful apps. These apps make use of the high-level components provided by App Inventor (Texting, LocationSensor, TextToSpeech) but require no repeat loops or complex logic. An example is this screencast of No Text While Driving, an app designed by Daniel Finnegan, a Politics major in my class at USF.

Level 1: Anyone who likes French Accents: Apps with some sophisticated logic. This level requires some hard thinking and problem solving. The blocks language has gotten you past the syntax, but now you need to piece together some repeat loops and index variables, and maybe a nested if-else. Examples of apps at this level include the Quiz and Create a Quiz tutorials I wrote for the App Inventor site. Who can do this? Just about anyone, but here you start losing some people that just don’t want to think that hard.

Level 2.0:  Apps that talk to APIs: You can get past the limitations of the visual environment by talking to back-end web services. Here you need to program in another language like Python, or know a programmer real well. App Inventor has provided a bridge with its TinyWebDB component. Basically, a programmer has to write a web service proxy that talks to the service you want and follows the App Inventor protocol. Then App Inventor programmers can create client apps that use TinyWebDB to communicate. I’ve written a few App Inventor web services using Python and App Engine, including proxies for Amazon, Yahoo Finance, and San Francisco’s NextMuniBus API (my students used this service to build their DroidMuni app with App Inventor).

The web service programming is quite simple,  for a programmer. You can download one of my samples and build an App-Inventor compliant service within minutes. But the barrier is back up, big time: most people will never write web services. But I do envision the following:

  • Some App Inventor programmers graduating to Python (or another language) because they are so motivated.
  • Organizations providing App-Inventor-compliant APIs that App Inventor programmers can then mash.
  • Collaborations, on-line or off, of App Inventor client programmers and App Inventor API builders. For instance, one of my CS 1 students worked with some CS 0 (App Inventor) students in this way to build an app using the Eventful API.
  • Yahoo-Pipes-like functionality for App Inventor

Level 2.0, the bridge to “back-end code”,is the key to App Inventor’s success. Without it, App Inventor would have been a nice educational tool. With it, App Inventor will change the world of app development.

Not sure? I’m not either, but they say you should bet on the toolmaker, along with the tool. Dan Gillmor wrote this about Hal Abelson, App Inventor co-director:

a brilliant computer scientist who also understands how app development needs to get into wider distribution, not just the coder community

This statement resonates with my experience working with Hal and the team during the university pilot and this summer. They are money, and they don’t even know it. This is why I’ve thrown my hat in with App Inventor.

The Programmers are coming!

Google has targeted education with App Inventor, but its clear that the tool will attract major interest from programmers and web designer/developers. Programmers see the potential because of the the TinyWebDB component which allows an App Inventor apps to communicate with web services.

Early adopter Dean Sanvitale has already built an RSS reader app and a Flickr explorer app. He did this by modifying a sample “tinywebdb-compliant” web service to create http://tinywebdbplus.appspot.com/ then writing an App Inventor client that talks to it. The pic on the right is his RSS reader app running in an emulator.

For more on how to build App Inventor (tinywebdb-) compliant web services, as well as sample source code, see http://appinventor.org/talking-to-an-api and http://appinventor.googlelabs.com/learn/reference/other/tinywebdb.html (The sample is written in Python/App Engine)

Good work Dean and, programmers, rev your engines!

A TechCrunch “Posts API” App

App Inventor for Android app that talks to TechCrunch API

Jason Kincaid posted an excellent  TechCrunch article on App Inventor and his initial experience. His first idea was to create create “an application that would allow a user to monitor TechCrunch headlines for keywords, which could come in handy if a startup wanted to get notified whenever we wrote a post about them.”

He quickly was stymied, realizing that App Inventor doesn’t yet have an RSS feed component. App Inventor does have a more general web service component, however, TinyWebDB. I used it, and App Engine for Python, to code up a simplified App Inventor version of his idea, a TechCrunch Posts API Android Client.

You can download the app and its source code at the link above. The app took me 20 minutes to create.

The sample doesn’t demonstrate what a non-programmer can do with App Inventor, as I had to write some Python code. It does demonstrate how App Inventor can be used by programmers and/or teams with a programmer to quickly develop and prototype apps.