top of page

No Text Whilst Driving - App Inventor 2 - Advanced Tutorial

 

This chapter walks you through the creation of No Texting While Driving, a “text answering machine” app that auto-responds to text messages you receive while you’re driving (or in the office,  etc.), speaks text messages aloud, and even sends location information as part of the automated text reply. The app demonstrates how you can control some of the great features of an Android phone, including SMS texting, text-to-speech, persistent data, and GPS location sensing.

 

In January 2010, the United States National Safety Council (NSC) announced the results of a study that found that at least 28 percent of all traffic accidents—close to 1.6 million crashes every year—are caused by drivers using cell phones, and at least 200,000 of those accidents occurred while drivers were texting.1 As a result, many states have banned drivers from using cell phones altogether.

 

Daniel Finnegan, a student at the University of San Francisco taking an App Inventor programming class, came up with an app idea to help with the driving and texting epidemic. The app he created, responds automatically (and hands-free) to any text with a message such as “I’m driving right now, I’ll contact you shortly.” The app was later extended so that it would speak the incoming texts aloud and add the driver’s GPS location to the auto-response text, and it was turned into a tutorial for the App Inventor site.

 

Some weeks after the app was posted on the App Inventor site, State Farm Insurance created an Android app called On the Move, which had similar functionality to NoTexting While Driving.

 

We don’t know if Daniel’s app or the tutorial on the App Inventor site influenced On the Move, but it’s interesting to consider the possibility that an app created in a beginning programming course (by a creative writing student, no less!) might have inspired this mass-produced piece of software, or at least contributed to the ecosystem that brought it about. It certainly demonstrated how App Inventor has lowered the barrier of entry so that anyone with a good idea can quickly and inexpensively turn his idea into a tangible, interactive app. Clive Thompson of  Wired magazine picked up on the novelty and wrote this:

 

Software, after all, affects almost everything we do. Pick any major problem—global warming, health care, or, in Finnegan’s case, highway safety—and clever software is part of the solution. Yet only a tiny chunk of people ever consider learning to write code, which means we’re not tapping the creativity of a big chunk of society.

 

App Inventor is about tapping the creativity Thompson mentions, about opening up the world of software creation to everyone.

 

What You’ll Learn

 

This is a more complex app than those in the previous chapters, so you’ll build it one

piece of functionality at a time, starting with the auto-response message. You’ll learn

about:

 

• The Texting component for sending texts and processing received texts.

 

• An input form for submitting the custom response message.

 

• The TinyDB database component for saving the customized message even after the app is closed.

 

• The Screen.Initialize event for loading the custom response when the app launches.

 

• The TextToSpeech component for speaking texts aloud.

 

• The LocationSensor component for reporting the driver’s current location.

bottom of page