ACS-1805 Introduction to Programming 1805 introduces students to programming using technology for creating programs that run on Android devices. Android: • operating system for smart phones and tablet computers • based on Linux • developed by Google in conjunction with the Open Handset Alliance • Apps can be created using Java, App Inventor and other environments • Apps are run in the Dalvik virtual machine Chapter 1. Hello Purr (Introduction to programming with AI) Demonstration: building an app with App Inventor , pages 1-10 1. We will build the Hello Purr app in class 2. This is a simple app that displays two things on the screen a) An instruction to the user to ‘pet’ the kitty b) A picture of a kitty 3. When the app is running on an Android device (emulator, phone, or tablet computer), the user will ‘touch’ the kitty and the kitty will meow 4. For this app the programmer determines two things: what appears on the screen, and what behaviour is required. Chapter 1. Hello Purr Demonstration: building an app with App Inventor, pages 1-10 1. Starting app inventor in a browser beta.appinventor.mit.edu 2. Create a new project (app) 3. Create the user interface (the screen’s appearance) a) A button with a picture b) A label with text giving the user directions to follow c) A sound to be made by the kitty (?) 4. Start the blocks editor a) Define the behaviour for components. That is, write the code for when the user clicks the button … 5. Running the app in the emulator Chapter 1. Hello Purr Introduction to building apps with App Inventor, pages 1-10 1. Optional: David Wolber’s youtube videos http://www.youtube.com/watch?v=Fu8zwNQt5XE&list=PLCF 2969C390CE87F4 2. Lots of other videos exist on youtube and elsewhere Chapter 1. Hello Purr Summary, pages 1-10 The App Inventor Programming environment has 3 major components: 1. Component Designer. This comprises several areas: a) Palette. The Palette itself has several sub-palettes. b) Viewer – shows a rough view of your app’s screen (user interface) c) Components List – a list of your app’s components (visible & nonvisible) d) Properties – shows the properties of the current component selected in the List. e) Media – shows the sounds and images of your app Chapter 1. Hello Purr Summary 2. Blocks editor (this happens to be a program written in Java) a) facilitates creating program blocks that describe and control behaviour within the app. Our example has a When Button is Clicked block. 3. Android emulator –emulates an Android phone Chapter 1. Hello Purr Page 11+ Optional Page 11: Adding a Purr 1. An additional operation is specified for the When Button is Clicked event occurs – Sound1.vibrate executes. Page 13: Shaking the Phone 1. 2. The phone emulated by App Inventor has an accelerometer sensor (detects motion). Motion can be detected using a When Accelerometer is Shaking event block. Of course, this requires an AccelerometerSensor component. Page 14: Downloading an app to a phone or tablet