Introduction to Android Programming (CS5248 Fall 2015) Aditya Kulkarni August 26, 2015 *Based on slides from Paresh Mayami.

Slides:



Advertisements
Similar presentations
Android Application Development A Tutorial Driven Course.
Advertisements

Google Android Introduction to Mobile Computing. Android is part of the build a better phone process Open Handset Alliance produces Android Comprises.
Android OS : Core Concepts Dr. Jeyakesavan Veerasamy Sr. Lecturer University of Texas at Dallas
Application Fundamentals Android Development. Announcements Posting in D2L Tutorials.
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
Android: Hello World Frank Xu Gannon University. Steps Configuration ▫Android SDK ▫Android Development Tools (ADT)  Eclipse plug-in ▫Android SDK and.
Mobile Application Development
Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
Android Programming Beomjoo Seo Sep., 12 CS5248 Fall 2012.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
UFCFX5-15-3Mobile Device Development Android Development Environments and Windows.
How to make it work? Doncho Minkov Telerik Academy academy.telerik.com Technical Trainer
@2011 Mihail L. Sichitiu1 Android Introduction Application Fundamentals.
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Android Application Development CSE 5520/4520 Wireless Networks.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Android and Eclipse Thaddeus Diamond CPSC 112. A Quick Introduction Eclipse is an IDE (Integrated Development Environment Open Source Much more full-featured.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Android Programming By Mohsen Biglari Android Programming, Part1: Introduction 1 Part1: Introduction By Mohsen Biglari.
PARSING FACEBOOK DATA FOR ANDROID 1. Step by Step  Import Android SDK  Get the hash key  Create a new app  Create a new project in Eclipse 
Prerequisites Android Studio – io.html io.html Java.
Copyright© Jeffrey Jongko, Ateneo de Manila University Android.
Introduction to Android. Android as a system, is a java based operating system that runs on the Linux kernel. The system is very lightweight and full.
Ali Shahrokni Application Components Activities Services Content providers Broadcast receivers.
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
Rajab Davudov. Agenda Eclipse, ADT and Android SDK APK file Fundamentals – Activity – Service – Content Provider – Broadcast Receiver – Intent Hello World.
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit
Mobile Application Development using Android Lecture 2.
DUE Hello World on the Android Platform.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
#gsa2012 Android Basics By: Amr Mohsen
Android for Java Developers Denver Java Users Group Jan 11, Mike
Presented By: Muhammad Tariq Software Engineer Android Training course.
INTRODUCTION TO ANDROID. Slide 2 Application Components An Android application is made of up one or more of the following components Activities We will.
Overview of Android Application Development
CS378 - Mobile Computing Intents. Allow us to use applications and components that are part of Android System – start activities – start services – deliver.
Android architecture & setting up. Android operating system comprises of different software components arranges in stack. Different components of android.
Configuring Android Development Environment Nilesh Singh.
First Venture into the Android World Chapter 1 Part 2.
 Installation of Android Development Environment  Creating the App with OpenGL ES API  Running the App on Emulator Android App Development.
1 Android Introduction Platform Overview. 2 What is Android?  Android is a software stack for mobile devices that includes an operating system, middleware.
ANDROID APPLICATION DEVELOPMENT. ANDROID DEVELOPMENT DEVELOPER.ANDROID.COM/INDEX.HTML THE OFFICIAL SITE FOR ANDROID DEVELOPERS. PROVIDES THE ANDROID SDK.
TODAY Android Studio Installation Getting started Creating your 1 st App Beginning to understanding Intents.
Lecture 2: Android Concepts
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
Android apps development - Eclipse, Android SDK, and ADT plugin Introduction of.
Introduction to Android Programming
The Basics of Android App Development Sankarshan Mridha Satadal Sengupta.
Intro To Android Programming
Mobile Device Development
Android Application -Architecture.
Android 01: Fundamentals
Android Application Development 1 6 May 2018
Obtaining the Required Tools
Android Runtime – Dalvik VM
Android Studio, Android System Basics and Git
Android.
Development-Introduction
CMPE419 Mobile Application Development
CS323 Android Getting Started
Application Development A Tutorial Driven Course
Android Developer Fundamentals V2
Emerging Platform#3 Android & Programming an App
CMPE419 Mobile Application Development
Presentation transcript:

Introduction to Android Programming (CS5248 Fall 2015) Aditya Kulkarni August 26, 2015 *Based on slides from Paresh Mayami (Google Inc.)

Contents Introduction Android OS Environment Setup

Contents Introduction Android OS Environment Setup Creating and Building Android App Create an Android Project Building and Running Debugging

Contents Introduction Android OS Environment Setup Creating and Building Android App Create an Android Project Building and Running Debugging General Topics Android Application Components Misc: Media Recorder, MediaCodec, HTTP Post, MP4Parser

Contents Introduction Android OS Environment Setup Creating and Building Android App Create an Android Project Building and Running Debugging General Topics Android Application Components Misc: Media Recorder, MediaCodec, HTTP Post, MP4Parser Sample Application

Application Fundamentals Android apps are written in Java

Application Fundamentals Android apps are written in Java The Android OS is a multi-user Linux system

Application Fundamentals Android apps are written in Java The Android OS is a multi-user Linux system Android app lives in its own security sandbox System assigns each app a unique Linux user ID Each process has its own virtual machine Every application runs in its own Linux process

Application Fundamentals Android apps are written in Java The Android OS is a multi-user Linux system Android app lives in its own security sandbox System assigns each app a unique Linux user ID Each process has its own virtual machine Every application runs in its own Linux process The Android system implements the principle of least privilege

Environment Setup Four basic steps to get an App running Step 1: Install JDK

Environment Setup Four basic steps to get an App running Step 1: Install JDK Step 2: Configure the SDK

Environment Setup Four basic steps to get an App running Step 1: Install JDK Step 2: Configure the SDK Step 3: Create your first Android App

Environment Setup Four basic steps to get an App running Step 1: Install JDK Step 2: Configure the SDK Step 3: Create your first Android App Step 4: Build and Run your App

Step-1: Install JDK

JDK Installation JDK and JRE are different! Can download the JDK for your OS at Alternatively, for OS X, Linux: –OS X: Open /Applications/Utilities/Terminal.app Type javac at command line Install Java when prompt appears –Linux: Type sudo apt–get install default–jdk at command line (Debian, Ubuntu) Other distributions: consult the documentation

Install! 16

Step-2: Configure the SDK

SDK Configuration Download Android SDK from

SDK Configuration Download Android SDK from Or Simplest: Download and install Android Studio bundle (including Android SDK) for your OS

Install! 20

Step-3: Create your first Android App

Your first Android App

Long time ago, in a galaxy far, far away …

Eclipse IDE- Official IDE for Android development ADT plugin Apache Ant for building projects

… so Google said …

Install

Run

Recommended: Install Android 2.2, APIs and 4.x API Do not worry about Intel x86 Atom, MIPS system images Settings Run Android SDK Manager

Now you are ready for Android development!

Create new Android project

Create Activity

The Manifest File Identify any user permissions the application requires

The Manifest File Identify any user permissions the application requires Declare the minimum API level required by the application

The Manifest File Identify any user permissions the application requires Declare the minimum API level required by the application Declare hardware and software features used or required by the application

The Manifest File Identify any user permissions the application requires Declare the minimum API level required by the application Declare hardware and software features used or required by the application API libraries the application needs to be linked

The Manifest File

Step-4: Building & Running your App

Building Process Running

No Android Device?

Install USB Driver !!!

Install OEM USB Driver from ASUS website. and search by Transformer Update Driver Software from Device Manager Locate USB Driver folder Enable USB Debugging at Transformer USB Driver Installation Update Driver software

Enabling USB Debugging

Running Sample App

Sample “Hello World” Code

Editing Sample Code Add id to main.xml

Editing Sample Code Add id to main.xml Edit HelloWorldActivity.java

A Sample Code

Important points 1.UI Element has an Id 2.Variables in our code link to UI elements 3.Update UI element content from the program 1 2 3

App Failure

Let us debug the code …

Always, look at DDMS !!!

Correction

Debugging via Dalvik Debug Monitor Service (DDMS) Log.e("Hello, World", "Hello, BJ");

Android Application Components

Application Components Android Application.apk : Android package

Application Components Android Application.apk : Android package Four Application Components Activity Service Content Provider Broadcast Receiver

Application Components Android Application.apk : Android package Four Application Components Activity Service Content Provider Broadcast Receiver Communication among components except Content Provider Intent

Activity Activity LifecycleImplement Lifecycle Callbacks

Activity Hierarchical View Architecture ViewGroup (Layout) View ViewGroup (Layout) View … View ViewGroup …

Activity Hierarchical View Architecture ViewGroup (Layout) View ViewGroup (Layout) View … View ViewGroup … Do not forget to declare Activity in the Manifest

Activity Start an Activity Start an Activity for a Result Caller Activity Callee Activity finish

Activities and Stack

Services A service is a component that runs in the background to perform long-running operations

Services A service is a component that runs in the background to perform long-running operations A service does not provide a user interface

Services A service is a component that runs in the background to perform long-running operations A service does not provide a user interface Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it

Services A service is a component that runs in the background to perform long-running operations A service does not provide a user interface Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it e.g a service might play music in the background while the user is in a different app

Broadcast Receivers A broadcast receiver is a component that responds to system-wide broadcast announcements

Broadcast Receivers A broadcast receiver is a component that responds to system-wide broadcast announcements Apps can also initiate broadcasts

Broadcast Receivers A broadcast receiver is a component that responds to system-wide broadcast announcements Apps can also initiate broadcasts Although broadcast receivers don't display a UI, they may create a status bar notification to alert the user when a broadcast event occurs

Content Providers A content provider manages a shared set of app data

Content Providers A content provider manages a shared set of app data Through the content provider, other apps can query or even modify the data

Content Providers A content provider manages a shared set of app data Through the content provider, other apps can query or even modify the data Any app with the proper permissions can query part of the content provider

Intent An intent is an abstract description of an operation to be performed

Intent An intent is an abstract description of an operation to be performed It can be used with startActivity to launch an ActivitystartActivity Activity

Intent An intent is an abstract description of an operation to be performed It can be used with startActivity to launch an ActivitystartActivity Activity broadcastIntent to send it to any interested BroadcastReceiver componentsbroadcastIntent BroadcastReceiver

Intent An intent is an abstract description of an operation to be performed It can be used with startActivity to launch an ActivitystartActivity Activity broadcastIntent to send it to any interested BroadcastReceiver componentsbroadcastIntent BroadcastReceiver startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background ServicestartService(Intent)bindService(Intent, ServiceConnection, int)Service

UI – Declaring Layout Initiated when called setContentView() on onCreate()

UI – Declaring Layout Initiated when called setContentView() on onCreate() Use Visual Layout Editor for initial layout design

UI – Declaring Layout Initiated when called setContentView() on onCreate() Use Visual Layout Editor for initial layout design Edit XML file extensively

UI – Handling UI Events onClick, onLongClick, onKey, onTouch, …

Thread UI Thread “Main” thread per application is responsible for interacting with UI components

Thread UI Thread “Main” thread per application is responsible for interacting with UI components “Application Not Responding” problem If UI thread is blocked more than several seconds, ANR dialog appears Do not block the UI thread Do not access UI components outside UI thread

Thread UI Thread “Main” thread per application is responsible for interacting with UI components “Application Not Responding” problem If UI thread is blocked more than several seconds, ANR dialog appears Do not block the UI thread Do not access UI components outside UI thread modify

Use AsyncTask, Instead

Misc - Media Recorder Modify CameraPreview to see the video during recording

Misc – Media Codec To access low-level media codecs, i.e. encoder/decoder components

Misc - HTTP Post Use HttpClient and HttpPost Use “multi-part/form-data” to encapsulate segment Do not excessively use memory

Misc – Permission Issue Add following permissions to the Manifest file

Sample Implementation MainActivity CaptureActivity Upload Service PlayerActivity Option menuContext menu Capture Capture Button Click Play click Background Upload

Misc - Integration with MP4Parser Adding a jar file Create its jar file Add jar file to the app Build Path > Configure Build Path > Libraries > Add JARs If you include source files directly, Put Isoparser-default.properties to assets folder Change getResourceAsStream(“isoparser- default.properties”) in PropertyBoxParserImpl to “/assets/isoparser-default.properties”

Final Comment: Use ApiDemo !!!

General References How to work with Android GUI layouts Building and running your app Deployment of the.apk file apk-file-in-the-android-emulator apk-file-in-the-android-emulator Find the hidden developer option to/restore-the-developer-options-menu-in-android-4-2/ to/restore-the-developer-options-menu-in-android-4-2/ Rotation lock/unlock to-make-your-android-phone-stop-rotating-the-screen-when- you%E2%80%99re-reading-sideways/ to-make-your-android-phone-stop-rotating-the-screen-when- you%E2%80%99re-reading-sideways/ Video tutorials Load/Open an existing package (e.g., the provided ClassExamples) into your eclipse File --> Import... --> General-Tab --> Existing Projects into Workspace (and click Next) Select root Directory: click Browse: select the folder the include the AndroidManifest.xml or project.properties files. Click finish

Thank You! Any questions