CS 528 Mobile and Ubiquitous Computing Lecture 1b: Introduction to Android. Emmanuel Agu

Similar documents
CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android. Emmanuel Agu

CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 3: Android UI Design in XML + Examples. Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Fragments, Camera Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 1: Introduction. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Data-Driven Views and Android Components Emmanuel Agu

Introduction To Android

CS 4518 Mobile and Ubiquitous Computing Lecture 4: WebView (Part 2) Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu

Android App Development. Muhammad Sharjeel COMSATS Institute of Information Technology, Lahore

Android. Lesson 1. Introduction. Android Developer Fundamentals. Android Developer Fundamentals. to Android 1

Android App Development

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Playing Sound and Video Emmanuel Agu

ANDROID SYLLABUS. Advanced Android

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu

Mobile Programming Lecture 1. Getting Started

Android Programming Lecture 2 9/7/2011

CS 403X Mobile and Ubiquitous Computing Lecture 5: Web Services, Broadcast Receivers, Tracking Location, SQLite Databases Emmanuel Agu

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle

Getting Started with Android Development Zebra Android Link-OS SDK Android Studio

CS 528 Mobile and Ubiquitous Computing Lecture 3: Android UI, WebView, Android Activity Lifecycle Emmanuel Agu

Introduction to Android

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.

ANDROID APPS (NOW WITH JELLY BEANS!) Jordan Jozwiak November 11, 2012

Fig. 2.2 New Android Application dialog. 2.3 Creating an App 41

ECE 1778: Creative Applications for Mobile Devices

Software Development & Education Center ANDROID. Application Development

Developer s overview of the Android platform

CS 4518 Mobile and Ubiquitous Computing Lecture 6: Databases, Camera, Face Detection Emmanuel Agu

Android Development Tutorial. Yi Huang

Minds-on: Android. Session 1

Android Overview. Most of the material in this section comes from

Android Software Development Kit (Part I)

Android Programming in Bluetooth Cochlea Group

Mobile and Wireless Systems Programming

BCA 6. Question Bank

ORACLE UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

SHWETANK KUMAR GUPTA Only For Education Purpose

GUJARAT TECHNOLOGICAL UNIVERSITY

Android App Development

CS378 -Mobile Computing. What's Next?

SD Module- Android Programming

CS 403X Mobile and Ubiquitous Computing Lecture 14: Google Places, Other Useful Android APIs and Cool Location Aware Apps Emmanuel Agu

CS 403X Mobile and Ubiquitous Computing Lecture 1: Introduction. Emmanuel Agu

COMP4521 EMBEDDED SYSTEMS SOFTWARE

Android. (XKE Mars 2009) Erwan Alliaume.

Android Development Crash Course

Android" Application Development SAMS. Sams Teach Yourself. Shane Conder. Lauren Darcey. Second Edition

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Android HelloWorld - Example. Tushar B. Kute,

Introduction to Android Application Development. Mike Kvintus Principal Engineer JDSU

Introduction to Android

Lecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement.

Chapter 1 Hello, Android

CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle

Required Core Java for Android application development

Android Online Training

Mobile Computing Meets Research Data

Mobile OS. Symbian. BlackBerry. ios. Window mobile. Android

Android App Development. Ahmad Tayeb

Android - open source mobile platform

CPET 565 Mobile Computing Systems CPET/ITC 499 Mobile Computing. Lab & Demo 2 (1 &2 of 3) Hello-Goodbye App Tutorial

Introduction to Android Development

Programming Android UI. J. Serrat Software Design December 2017

Tutorial on Basic Android Setup

ios vs Android By: Group 2

Developing Applications for ios

CMSC 628: Introduction to Mobile Computing

1. Implementation of Inheritance with objects, methods. 2. Implementing Interface in a simple java class. 3. To create java class with polymorphism

PAPER ON ANDROID ESWAR COLLEGE OF ENGINEERING SUBMITTED BY:

The World of Android Development

17655: Discussion: The New z/os Interface for the Touch Generation

Android Application Development 101. Jason Chen Google I/O 2008

XML Tutorial. NOTE: This course is for basic concepts of XML in line with our existing Android Studio project.

CS 4518 Mobile and Ubiquitous Computing Lecture 15: Final Project Slides/Paper, Other Ubicomp Android APIs Emmanuel Agu

Mobile Computing. Introduction to Android

Lab 1 - Setting up the User s Profile UI

Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.

CS 528 Mobile and Ubiquitous Computing Lecture 4b: Face Detection, recognition, interpretation + SQLite Databases Emmanuel Agu

Android Application Development

Mobile Application Development - Android

Lab 3. Accessing GSM Functions on an Android Smartphone

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015

CMSC 436 Lab 10. App Widgets and Supporting Different Devices

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011

Introduction to Mobile Application and Development

(Refer Slide Time: 0:48)

Syllabus- Java + Android. Java Fundamentals

Mobile Computing LECTURE # 2

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

Android Overview. Francesco Mercaldo, PhD

Mobile Application Development

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

Transcription:

CS 528 Mobile and Ubiquitous Computing Lecture 1b: Introduction to Android Emmanuel Agu

What is Android? Android is world s leading mobile operating system Open source (https://source.android.com/setup/) Google: Owns Android, maintains it, extends it Distributes Android OS, developer tools, free to use Runs Android app market

SmartPhone OS Over 80% of all phones sold are smartphones Android share 86% worldwide Source: Statista

Android Growth Over 2 billion Android users, March 2017 (ref: the verge) 3.3 million apps on the Android app market (ref: statista.com) Games, organizers, banking, entertainment, etc

Android is Multi-Platform Google Glass (being redone) In-car console Smartwatch Android runs on all these devices Smartphone Tablet This Class: Focuses Mostly on Smartphones! Devices/Things (e.g. Raspberry Pi) Television

Why Android for Mobile Computing and Ubicomp? Android for Mobile programmable modules Audio/video playback, taking pictures, database, location detection, maps Android for Ubicomp programmable modules Sensors (temperature, humidity, light, etc), proximity Face detection, activity recognition, place detection, speech recognition, speech-to-text, gesture detection, place type understanding, etc Machine learning, deep learning

Android Versions Class will use Android 7 ( Nougat ) Officially released December 5, 2016 Latest version is Android 9 (Pie), released August 2018 Below is Android version distribution as at July 23, 2018 Source: http://developer.android.com/about/dashboards/index.html

Android Developer Environment

New Android Environment: Android Studio Old Android dev environment used Eclipse + plugins Google developed it s own IDE called Android Studio Integrated development environment, cleaner interface, specifically for Android Development (e.g. drag and drop app design) In December 2014, Google announced it will stop supporting Eclipse IDE

Where to Run Android App Android app can run on: Real phone (or device) Emulator (software version of phone) Emulated phone in Android Studio

Running Android App on Real Phone Need USB cord to copy app from development PC to phone

Emulator Pros and Cons (Vs Real Phone) Pros: Conveniently test app on basic hardware by clicking in software Easy to test app on various emulated devices (phones, tablets, TVs, etc), various screen sizes Cons: Limited support, access to hardware, communications, sensors E.g. GPS, camera, video recording, making/receiving phone calls, Bluetooth devices, USB devices, battery level, sensors, etc Slower than real phone

New Support for Sensors Can now emulate some sensors (e.g. location, accelerometer), but still limited

Demo: Android Studio

Android Software Framework

Android Functionality as Apps Android functionality: collection of mini-applications (apps) Even dialer, keyboard, etc

Android Software Framework OS: Linux kernel, drivers Apps: programmed & UI in Java Libraries: OpenGL ES (graphics), SQLite (database), etc

Android Software Framework Each Android app runs in its own security sandbox (VM, minimizes complete system crashes) Android OS multi-user Linux system Each app is a different user (assigned unique Linux ID) Access control: only process with the app s user ID can access its files Ref: Introduction to Android Programming, Annuzzi, Darcey & Conder

Android Programming Languages Two main languages to program Android 1. Java-based (Native) programming + XML: We will focus on that in this class 2. Kotlin: New alternative way, Higher level, easier? We will give overview of Kotlin later in class Google is encouraging developers to switch to kotlin

Android Apps: Big Picture

UI Design using XML UI design code (XML) separate from the program (Java) Why? Can modify UI without changing Java program Example: Shapes, colors can be changed in XML file without changing Java program UI designed using either: Drag-and drop graphical (WYSIWYG) tool or Programming Extensible Markup Language (XML) XML: Markup language, both human-readable and machine-readable''

Android App Compilation Android Studio compiles code, data and resource files into Android PacKage (filename.apk)..apk is similar to.exe on Windows Apps download from Google Play, or copied to device as filename.apk Installation = installing apk file

Activities Activity? 1 Android screen or dialog box Apps Have at least 1 activity that deals with UI Entry point, similar to main( ) in C Typically have multiple activities Example: A camera app Activity 1: to focus, take photo, launch activity 2 Activity 2: to view photo, save it Activities independent of each other E.g. Activity 1 can write data, read by activity 2 App Activities derived from Android s Activity class

Our First Android App

3 Files in Hello World Android Project Activity_my.xml: XML file specifying screen layout MainActivity.Java: Java code to define behavior, actions taken when button clicked (intelligence) AndroidManifest.xml: Lists all screens, components of app Analogous to a table of contents for a book E.g. Hello world program has 1 screen, so AndroidManifest.xml has 1 item listed App starts running here (like main( ) in C) Note: Android Studio creates these 3 files for you

Execution Order Next: Samples of AndroidManifest.xml Hello World program Start in AndroidManifest.xml Read list of activities (screens) Start execution from Activity tagged Launcher Create/execute activities (declared in java files) E.g. MainActivity.Java Format each activity using layout In XML file (e.g. Activity_my.xml)

Inside Hello World AndroidManifest.xml This file is written using xml namespace and tags and rules for android Your package name Android version List of activities (screens) in your app One activity (screen) designated LAUNCHER. The app starts running here

Execution Order Start in AndroidManifest.xml Read list of activities (screens) Start execution from Activity tagged Launcher Next Create/execute activities (declared in java files) E.g. MainActivity.Java Format each activity using layout In XML file (e.g. Activity_my.xml)

Example Activity Java file (E.g. MainActivity.java) Package declaration Import needed classes My class inherits from Android activity class Initialize by calling oncreate( ) method of base Activity class Note: Android calls your Activity s oncreate method once it is created Use screen layout (design) declared in file main.xml

Execution Order Start in AndroidManifest.xml Read list of activities (screens) Start execution from Activity tagged Launcher Create/execute activities (declared in java files) E.g. MainActivity.Java Next Format each activity using layout In XML file (e.g. Activity_my.xml)

Widget properties (e.g. center contents horizontally and vertically) Simple XML file Designing UI After choosing the layout, then widgets added to design UI XML Layout files consist of: UI components (boxes) called Views Different types of views. E.g TextView: contains text, ImageView: picture, WebView: web page Views arranged into layouts or ViewGroups Declare Layout Add widgets

Android Files

Android Project File Structure 3 Main Files to Write Android app

Files in an Android Project res/ (resources) folder contains static resources you can embed in Android screen (e.g. pictures, string declarations, etc) res/menu/: XML files for menu specs res/drawable-xyz/: images (PNG, JPEG, etc) at various resolutions res/raw: general-purpose files (e.g. audio clips, mpeg, video files, CSV files res/values/: strings, dimensions, etc

Concrete Example: Files in an Android Project res/layout: layout, dimensions (width, height) of screen cells are specified in XML file here res/drawable-xyz/: The images stored in jpg or other format here java/: App s response when user clicks on a selection is specified in java file here AndroidManifext.XML: Contains app name (Pinterest), list of app screens, etc

Editting in Android Studio

Editting Android Can edit apps in: Text View: edit XML directly Design View: or drag and drop widgets unto emulated phone

Android UI Design in XML

Recall: Files Hello World Android Project XML file used to design Android UI 3 Files: Activity_main.xml: XML file specifying screen layout MainActivity.Java: Java code to define behavior, actions taken when button clicked (intelligence) AndroidManifest.xml: Lists all app components and screens Like a table of contents for a book E.g. Hello world program has 1 screen, so AndroidManifest.xml has 1 item listed App starts running here (a bit like main( ) in C), launching activity with a tag LAUNCHER

Widgets Android UI design involves arranging widgets on a screen Widgets? Rectangles containing texts, image, etc Screen design: Pick widgets, specify attributes (dimensions, margins, etc) Widgets

Design Option 1: Drag and Drop Widgets Drag and drop widgets in Android Studio Design View Edit widget properties (e.g. height, width, color, etc) rag and drop utton or any ther widget r view Edit widget properties

Design Option 2: Edit XML Directly Text view: Directly edit XML file defining screen (activity_main.xml) Note: dragging and dropping widgets in design view auto-generates corresponding XML in Text view Drag and drop widget Edit XML

References Android App Development for Beginners videos by Bucky Roberts (thenewboston) Ask A Dev, Android Wear: What Developers Need to Know, https://www.youtube.com/watch?v=zts2nzplyqg Ask A Dev, Mobile Minute: What to (Android) Wear, https://www.youtube.com/watch?v=n5yjzn3b_aq Busy Coder s guide to Android version 4.4 CS 65/165 slides, Dartmouth College, Spring 2014 CS 371M slides, U of Texas Austin, Spring 2014