App Inventor 2 Essentials
上QQ阅读APP看书,第一时间看更新

Preface

Almost everyone has had an idea for an app or perhaps declared, "I wish there were an app for that!" But until recently, taking an idea and building it into a fully functional app would have required hiring an expert software programmer and paying thousands and thousands of dollars. The world of mobile app development had been the domain of an elite group of people with highly specialized skills—proficient coders. The App Inventor project sought to change this reality by democratizing software development. App Inventor 2 is a free, blocks-based, drag-and-drop visual programming language that makes it possible for anyone, even people with no prior coding experience, to turn an idea into a fully functional Android app.

As educators, our passion for promoting global education and empowering people to move from being users of technology to becoming creators of technology were the inspirations for writing this book. With App Inventor, a 12-year-old, a speech therapist, a baseball coach, or anyone else for that matter, can develop an app that is personal, meaningful, and useful to them. People from all backgrounds and levels of education can develop a digital solution to a problem they see in their community. Any App Inventor app, such as an educational game, a music tutorial, or a garbage recycling program can be published or sold in app markets, and thus, have a global impact or spurn opportunities for entrepreneurship, collaboration, and community building.

App Inventor offers an alternative entry point to Computer Science that is more user-friendly and less intimidating than traditional cryptic white-text-on-a-black-screen programming. The colorful blocks that snap together like puzzle pieces along with a design tools enable users to learn both coding and user experience design skills. Furthermore, with a wide gender gap in computer science—males dominating both classes and jobs—we are also passionate about using App Inventor to introduce more girls and women to mobile computing opportunities, such as app contests with Technovation (www.technovationchallenge.org) and coding clubs with Girls Who Code (www.girlswhocode.com).

Because you can take any idea and turn it into a mobile app, the opportunities for imagination, creativity, and innovation are indeed endless. The purpose of this book is to help spark such creativity while introducing you to basic computer science principles, computational thinking, and programming. This book teaches you to navigate the App Inventor platform and helps you become familiar with its features through step-by-step tutorials on building three different mobile apps. Throughout the book, we offer design tools and tips as a pathway to user experience design, since the user interface is such an integral part of any mobile app. Ultimately, by the end of this book, you will be equipped with enough skills to embark on developing your own mobile app from scratch. We are excited to see the apps you are inspired to create and hope that you will share them with us.

We are so excited to share our passion for mobile app development with you and hope that this book awakens a creative spark to make technology that is personal, meaningful, and useful to you. We are thankful to Hal Abelson, Mark Friedman, and all of the original App Inventor developers and visionaries who created the platform that has evolved into App Inventor 2. We are proud to be furthering the App Inventor mission and encourage all of you budding software programmers to, in turn, share App Inventor with other noncoders. Together we can empower others to become part of a growing movement to connect and impact the world with digital creativity.

What this book covers

Chapter 1, Unleashing Creativity with MIT App Inventor 2, introduces you to the MIT App Inventor software and explores the multifaceted role of the mobile app developer by examining design processes and techniques used to turn an app idea into a prototype. By showing a variety of apps that people just like you have already made, this chapter reveals the range of learning outcomes and skills developed by using App Inventor.

Chapter 2, Setting Up MIT App Inventor 2, walks you through setting up a Google Account to log into App Inventor, downloading software, and connecting your computer to your mobile device via Wi-Fi or USB with Mac, Windows, or GNU/Linux. MIT App Inventor 2 is a free online application that runs in a web browser on your computer and saves your projects in the cloud. The magical part of App Inventor is live testing your app as you build it with the Integrated Development Environment (IDE). If you don't have a mobile device, don't worry, there are instructions on how to use App Inventor with the onscreen emulator. While we provide a step-by-step guide to getting started, we acknowledge that sometimes establishing connectivity can be a challenge. Therefore, we include plenty of troubleshooting and help options.

Chapter 3, Navigating the App Inventor Platform, familiarizes you with the App Inventor Projects View, Designer screen, and Blocks Editor. This chapter teaches you how to build a game app called Fling. The step-by-step tutorial integrates components and properties to design the user interface and colorful puzzle-like blocks to code the behavior of the game. You learn how to create buttons that start or reset play, move a ball, change the ball's direction by touching it, bounce the ball off the edges of the screen, and end game play. During each step of the development process, we show you how to view the changes on your mobile device. By the end of the chapter, you will have built a functional app! However, we have just gotten started on our app development journey.

Chapter 4, Fling App – Part 2, uses the basic app that we built in Chapter 3 as a launching pad for further skill development: debugging and expanding the app with more complex features. Since most games keep score and have increasing levels and difficulty, we augment the Fling tutorial to make a more intermediate app. You learn how to make a scoring mechanism, display the score, increase the speed of the ball, create levels, increase the difficulty of play, and debug by updating the Play and Reset buttons.

Chapter 5, Building an Event App, provides a tutorial for building a second app—this time, an intermediate event-planning app. An app like this can be useful for anyone who is gathering people together for meetings, parties, or events. It gathers information from people who would like to attend, namely, their name, the number of guests, and the pot-luck items to be brought. In return, the app displays to users a guest list and the event information, such as the address and a map. The tutorial teaches you how to include images and artwork, create a navigation menu, use the Backpack tool, add multiple screens, expand your use of labels, and include a map component. By the end of the chapter, you will have accomplished a great deal, but will only be halfway through the Event App development.

Chapter 6, Introduction to Databases, will cover databases that are an essential part of app designing because they store persistent data, meaning that when the app closes and reopens, the previously entered data will remain in the App. Without a database, any data entered by the user when the app is running would be lost once the app is closed. In order to collect user-inputted information for the Event app, this chapter's tutorial demonstrates how to create an RSVP form, establish Google API credentials, store and request information in a database using Google Fusion Tables, and display a guest list.

Chapter 7, Learning About Loops with a Raffle App, will cover a third tutorial—this time, for a Raffle App that includes the computer science principles of lists, loops, and variables. The Raffle App (a digital version of a regular raffle) can be used at a party, meeting break, or as an ice-breaker to involve participants in a short fun activity. Participants text a specific message to the Raffle organizer's phone and the app randomly selects a winner from the list of incoming numbers and then notifies the winner he or she has won and texts the rest of the participants that they did not win. Here, you will learn to code efficiently with variables and a loop, as the app repeats the same behavior (texting a "Sorry you did not win!" message) for a list of many people.

Chapter 8, Expanding Your Mobile App Development Skills, includes more design principles and App Inventor tips to broaden your skill set for your transition from app building with guided tutorials to creating mobile apps from scratch. Also included are app sharing tools that enable you to contribute your creativity and learn from other app developers. Since all the App Inventor apps can be uploaded, shared, and even sold in app markets, the apps you develop can make a global social impact or trigger your path as an entrepreneur. The world awaits your contribution!

What you need to build mobile apps

  • A free Google Account
  • An Android mobile device (phone or tablet)
    • Android Operating System 2.3 ("Gingerbread") or higher
  • A computer with one of the operating systems listed:
    • Macintosh (with Intel processor): Mac OS X 10.5 or higher
    • Windows: Windows XP, Windows Vista, Windows 7, 8, or 10
    • GNU/Linux: Ubuntu 8 or higher, Debian 5 or higher
  • A web browser:
    • Mozilla Firefox 3.6 or higher (Note: If you are using Firefox with the NoScript extension, you'll need to turn the extension off. See the note on the troubleshooting page.)
    • Apple Safari 5.0 or higher
    • Google Chrome 4.0 or higher
    • Microsoft Internet Explorer is not supported. Windows users should use Chrome or Firefox

Who this book is for

This book is for anyone wanting to learn how to create mobile apps for Android. No prior coding experience is necessary.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The file is named appinventor2-setup_1.1.tar.gz and it is a GZIP compressed TAR file."

Any command-line input or output is written as follows:

> /usr/google/appinventor/commands-for-Appinventor/aiStarter &

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "There are five games to choose from, including Refocus, True Color, Quick Pick, Sum It Up, and Expression Puzzle."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or found challenging. Reader feedback is important to us as it helps us develop resources that you will find useful and educational.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have an issue with any aspect of this book, you can contact us at , and we will do our best to address the problem.