Mobile Computing With Android ACST 4550 Intro to Android, Part 1

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 architecture overview
Chapter 1: Voilà! Meet the Android
Programming Mobile Applications with Android
Joemarie Comeros Amparo Android Development Orientation for Starters.
All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Android Programming Beomjoo Seo Sep., 12 CS5248 Fall 2012.
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Getting Started with Android Development Rohit Ghatol.
Android Application Development CSE 5520/4520 Wireless Networks.
Android Programming Day best Android Apps Lzo&feature=fvwrel.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Mobile Application Development with ANDROID Tejas Lagvankar UMBC 29 April 2009.
© by Pearson Education, Inc. All Rights Reserved. 1 Introduction to Android From “Android: How to Program” By Paul Deitel and Harvey Deitel.
Cosc 5/4730 Information, Resources, and basic GUI concepts.
© 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.
Introduction to Android Programming (CS5248 Fall 2015) Aditya Kulkarni August 26, 2015 *Based on slides from Paresh Mayami.
Presentation Seminar on “IMAGE SLIDER –AN ANDROID APPLICATION”
Social Media Apps Programming Min-Yuh Day, Ph.D. Assistant Professor Department of Information Management Tamkang University
© by Pearson Education, Inc. All Rights Reserved. 1 Introduction to Android From “Android: How to Program” By Paul Deitel and Harvey Deitel.
Android - Broadcast Receivers
Creating an Example Android App in Android Studio Activity lifecycle & UI Resources.
ANDROID L. Grewe Components  Java Standard Development Kit (JDK) (download) (latest version)  AndroidStudio.
Android History.
TCS Internal Maps. 2 TCS Internal Objective Objective :  MAPS o Integration of Maps.
Mobile Software Development for Android - I397 IT COLLEGE, ANDRES KÄVER, WEB:
Android Development For Beginners. What is Android? Android is an open mobile phone platform that was developed by Google and later by Open Handset Alliance.
Android. Android An Open Handset Alliance Project A software platform and operating system for mobile devices Based on the Linux kernel Developed by Google.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Introduction to Android Programming
COM594: Mobile Technology Practical – Week 1 Android and Android Studio.
Android Programming.
Intro To Android Programming
Mobile Software Development for Android - I397
Workshop by T.Naveen sai kumar.
Lab7 – Appendix.
Introduction to android
Android Application -Architecture.
Android Programming - Features
Android 01: Fundamentals
Android Application Development 1 6 May 2018
CS240: Advanced Programming Concepts
GUI Programming Fundamentals
Android Studio, Android System Basics and Git
Android.
Development-Introduction
CMPE419 Mobile Application Development
Mobile Device Development
CIS 470 Mobile App Development
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Application Development A Tutorial Driven Course
CMPE419 Mobile Application Development
Chapter 1: Basics of Android, First App: HelloAndroid
HNDIT2417 Mobile Application Development
Activities and Intents
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Mobile Programming Dr. Mohsin Ali Memon.
Cosc 4730 An Introduction.
CMPE419 Mobile Application Development
CMPE419 Mobile Application Development
Mobile Programming Broadcast Receivers.
Android Sensor Programming
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Mobile Computing With Android ACST 4550 Intro to Android, Part 1

Brief Android History The version history of the Android mobile operating system began with the release of the Android beta in November 2007. The first commercial version, Android 1.0, was released in September 2008. Android is under ongoing development by Google and the Open Handset Alliance, and has seen a number of updates to its base operating system since its original release. These updates typically fix bugs and add new features.

Brief Android History Since April 2009, Android versions have been developed under desert codenames and released in alphabetical order: Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich, Jelly Bean and KitKat. As of 2013, over 500 million active devices use the Android OS worldwide. In 2014 that number passed 1 billion active devices. As of 2015, Android has the largest installed base of all operating systems.

Brief Android History

Brief Android History

Getting Started (1) Need to install Java Development Kit (JDK) to write Java (and Android) programs Do not install Java Runtime Environment (JRE); JDK and JRE are different! Can download the JDK for your OS at http://java.oracle.com 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 distribution’s documentation

Getting Started (2) After installing JDK, download Android SDK from http://developer.android.com Simplest: download and install Android Studio bundle (including Android SDK) for your OS Alternatives: Download/install Android Developer Tools from this site (based on Eclipse) Install Android SDK tools by themselves, then install ADT for Eclipse separately (from this site) We’ll use Android Studio with SDK included (easy)

Getting Started (3) You should see this:

Getting Started (4) Strongly recommend testing with real Android device Android emulator: very slow Install USB drivers for your Android device! Bring up the Android SDK Manager Recommended: Install Android 4.03, 5.01 and 6.0 APIs 15, 21 and 23 Now you’re ready for Android development!

Android Highlights (1) Android apps execute on Dalvik VM, a “clean-room” implementation of JVM Dalvik optimized for efficient execution Dalvik: register-based VM, unlike Oracle’s stack-based JVM Java .class bytecode translated to Dalvik EXecutable (DEX) bytecode, which Dalvik interprets

Android Highlights (2) Android apps written in Java 5 Actually, a Java dialect (Apache Harmony) Everything we’ve learned still holds Apps use four main components: Activity: A “single screen” that’s visible to user Service: Long-running background “part” of app (not separate process or thread) ContentProvider: Manages app data (usually stored in database) and data access for queries BroadcastReceiver: Component that listens for particular Android system “events”, e.g., “found wireless device”, and responds accordingly

App Manifest Every Android app must include an AndroidManifest.xml file describing functionality The manifest specifies: App’s Activities, Services, etc. Permissions requested by app Minimum API required Hardware features required, e.g., camera with autofocus External libraries to which app is linked, e.g., Google Maps library

Activity Lifecycle Activity: key building block of Android apps Extend Activity class, override onCreate(), onPause(), onResume() methods Dalvik VM can stop any Activity without warning, so saving state is important! Activities need to be “responsive”, otherwise Android shows user “App Not Responsive” warning: Place lengthy operations in Runnable Threads, AsyncTasks Source: [12]

App Creation Checklist If you own an Android device: Ensure drivers are installed Enable developer options on device under Settings, specifically USB Debugging Android 4.2+: Go to Settings→About phone, press Build number 7 times to enable developer options For Android Studio: Under File→Settings→Appearance, enable “Show tool window bars”; the Android view shows LogCat, devices Programs should log states via android.util.Log’s Log.d(APP_TAG_STR, “debug”), where APP_TAG_STR is a final String tag denoting your app Other commands: Log.e() (error); Log.i() (info); Log.w() (warning); Log.v() (verbose) – same parameters

Creating Android App (1) Creating Android app project in Android Studio: Go to File→New Project Enter app, project name Choose package name using “reverse URL” notation, e.g., edu.osu.myapp Select APIs for app, then click Next

Creating Android App (2) Determine what kind of Activity to create; then click Next We’ll choose a Blank Activity for simplicity Enter information about your Activity, then click Finish This creates a “Hello World” app

Deploying the App Two choices for deployment: Real Android device Android virtual device Plug in your real device; otherwise, create an Android virtual device Emulator is slow. Try Intel accelerated version, or perhaps http://www.genymotion.com/ Run the app: press “Run” button in toolbar

Underlying Source Code src/…/MainActivity.java package edu.kennesaw.helloworld; import ... public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; }

Underlying Source Code (cont.) src/…/MainActivity.java @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }

Underlying GUI Code res/layout/activity_main.xml <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="edu.kennesaw.helloworld.MainActivity"> <android.support.design.widget.AppBarLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.AppBarLayout> <include layout="@layout/content_main"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_email" /> </android.support.design.widget.CoordinatorLayout>

The App Manifest AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="edu.kennesaw.helloworld" > <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

Java API Class Libraries Standard Java API: http://docs.oracle.com/javase/8/docs/api/ Android Java API: http://developer.android.com/reference/classes.html