APPFORUM2014 Helping the developer community build next-generation, multi-platform apps. SCHAUMBURG, ILLINOIS | SEPTEMBER 8-10.

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.
Android architecture overview
CSE2102 Introduction to Software Engineering Lab 2 Sept/4/2013.
Programming with Android: Activities
Android 02: Activities David Meredith
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.
The Android Activity Lifecycle. Slide 2 Introduction Working with the Android logging system Rotation and multiple layouts Understanding the Android activity.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Android Life Cycle CS328 Dick Steflik. Life Cycle The steps that an application goes through from starting to finishing Slightly different than normal.
Mobile Application Development
Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Getting Started with Android Development Rohit Ghatol.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
Intro to Android Programming George Nychis Srinivasan Seshan.
Android: versions Note that: Honeycomb (Android v3.0) A tablet-only release Jelly Bean (Android v4.1) Released on July 09, 2012.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
ANDROID UI – FRAGMENTS. Fragment  An activity is a container for views  When you have a larger screen device than a phone –like a tablet it can look.
Software Architecture of Android Yaodong Bi, Ph.D. Department of Computing Sciences University of Scranton.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Android Info mostly based on Pro Android 3.  User Applications  Java Libraries – most of Java standard edition ◦ Activities/Services ◦ UI/Graphics/View.
Android development basics Introduction,Structure,Development Boncho Valkov.Net Developer.
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
DUE Hello World on the Android Platform.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
Android for Java Developers Denver Java Users Group Jan 11, Mike
Copyright© Jeffrey Jongko, Ateneo de Manila University Of Activities, Intents and Applications.
10/10/2015 E.R.Edwards 10/10/2015 Staffordshire University School of Computing Introduction to Android Overview of Android System Android Components Component.
Overview of Android Application Development
Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml.
Android – Fragments L. Grewe.
ANDROID L. Grewe Components  Java Standard Development Kit (JDK) (download) (latest version)  AndroidStudio.
ANDROID BY:-AANCHAL MEHTA MNW-880-2K11. Introduction to Android Open software platform for mobile development A complete stack – OS, Middleware, Applications.
1 Android Introduction Platform Overview. 2 What is Android?  Android is a software stack for mobile devices that includes an operating system, middleware.
Lecture 2: Android Concepts
1 Android Workshop Platform Overview. 2 What is Android?  Android is a software stack for mobile devices that includes an operating system, middleware.
Activities and Intents Chapter 3 1. Objectives Explore an activity’s lifecycle Learn about saving and restoring an activity Understand intents and how.
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
Working with Multiple Activities. Slide 2 Introduction Working with multiple activities Putting together the AndroidManifest.xml file Creating multiple.
Introduction to Android Programming
Android Application -Architecture.
Lecture 2: Android Concepts
Activities, Fragments, and Events
MAD.
Activities and Intents
Android Mobile Application Development
The Android Activity Lifecycle
CMPE419 Mobile Application Development
Android training in Chandigarh. What is ADB ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator.
Android Programming Lecture 9
CIS 470 Mobile App Development
Application Development A Tutorial Driven Course
Activities and Intents
Activities and Intents
HNDIT2417 Mobile Application Development
CIS 470 Mobile App Development
Activities and Intents
Emerging Platform#3 Android & Programming an App
Mobile Programming Dr. Mohsin Ali Memon.
Lecture 2: Android Concepts
CMPE419 Mobile Application Development
Activities, Fragments, and Intents
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

APPFORUM2014 Helping the developer community build next-generation, multi-platform apps. SCHAUMBURG, ILLINOIS | SEPTEMBER 8-10

APPFORUM2014 JOHN SEIMER GLOBAL SOLUTION CENTERS ANDROID APPLICATION FUNDAMENTALS

Agenda Android application structure – crash course on application components –Activity –Services –Intents –BroadcastReceiver –ContentProvider Processes and Threading Data Storage

Dalvik Virtual Machine Dalvik Executable (.dex) format Optimized for minimal memory footprint Compilation Android Architecture

What is an APK File A package containing.DEX files Resources Assets Certificates Manifest file A.ZIP formatted package based on.JAR file format Manifest File Declares the components and settings of an application Identifies permissions (ie. network access) Defines the package of the app Defines the version Declares hardware and software features

Activity Service BroadcastReceiver ContentProvider Activating Components Intents Android Application Components

Activity Overview A screen with a UI A typical application may have many activities Typically expensive and so are managed by the system May be shutdown by the system

Activities are managed by the system’s Activity Manager. Applications show new screens by pushing a new activity onto the screen. Navigating back (via back button) causes the top screen to be popped off the stack. You define what happens in each callback. Activity Lifecycle

Activity Lifecycle Explored Starting for the first time onCreate onStart onResume Restarting next time onRestart onStart onResume Rotating the screen onSaveInstanceState onPause onStop onDestroy onCreate onStart onRestoreInstanceState onResume

Activity Implementation

Registering the Activity Register the activity in the manifest file:... <activity android:name=".ActivityDemo“ The intent filter specifies that this activity is to be the main entry point into the application as well as that it should be shown in the app launcher on home screen.

Building an Android UI There are 2 approaches to building Android User Interfaces: Declaratively Declare UI in XML Eclipse provides nice drag-n-drop tools Inflate the XML view in Java Programmatically Write Java code for the UI Instantiate all widgets programmatically Set properties for each Best approach is to combine both: 1.Declare the look and feel using XML 2.Inflate XML into Java. 3.Program the actions using Java.

Building an Android UI UI is built using a hierarchy of View and ViewGroup objects Android provides XML vocabulary for all View and ViewGroup objects so that UI can be defined in XML

Building an Android UI

Preference Activity Specialized activity that knows how to display, read and write application’s user preferences. import android.os.Bundle; import android.preference.PreferenceActivity; public class PrefsActivity extends PreferenceActivity protected void onCreate(Bundle savedInstanceState { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs); } R.xml.prefs refers to Preference screen resource.

Preference Activity res/xml/prefs.xml <CheckBoxPreference android:title="Background data" android:key="background_data" android:summary="Use background data?”> <ListPreference android:key="text_size" android:title="Text Size”>

Preference Activity

Intent Overview Intents are like events or messages. Can be used to start activities, start/stop services, or send broadcasts. Composed of an action that needs to be performed and the data that it needs to perform the action on. Can be implicit or explicit.

Using Intents Sample An activity can send an intent to start another activity: Intent I = new Intent (this, SecondActivity.class); startActivity(i); An intent can contain data to be used by the receiving component: String url = Intent i = new Intent (Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i);

Intent filter is a way for to assign certain action to an activity, service, receiver or similar. Action is one of system defined actions, or something developer can come up with. Intent filter typically goes into Android Manifest file, within,, or elements. Android Manifest file Intent Filters

Explicit Intent Sample ActivityDemo.java... startActivity(new Intent(this, AnotherActivity.class));... startService(new Intent(this, ServiceDemo.class));... this is the context from which this intent is being sent, in this case an Activity or Service

Implicit Intent Sample ActivityDemo.java... startService(new Intent(“MSI.intent.action.IntentServiceDemo"));... sendBroadcast(new Intent(“MSI.intent.action.ReceiverDemo"));... Requires an intent filter filtering for this particular intent.

Service Service Overview Service Lifecycle Service Lifecycle Explored Service Sample Service Callbacks Registering Service

Runs in the background Can be started and stopped No UI Service Overview

Starting a service first time  onCreate  onStartCommand Restarting the same service  onStartCommand Stopping the service  onDestroy Starting the intent service  onCreate  onHandleIntent  onDestroy Service Lifecycle

Registering a service that will be called explicitly by its class name Registering a service that will be called via action... … Registering a Service

Example Service

An Intent-based publish- subscribe mechanism Respond to broadcast messages from other applications or from the system. Great for listening for system events such as SMS messages Broadcast Receiver Overview

Registering in Android Manifest file Registering a Broadcast Receiver

Alerts the user in the status bar Contains the following elements: 1.Content title 2.Large icon 3.Content text 4.Content info 5.Small icon 6.Time the notification was issued Notification Overview

Data Storage Android provides a number of options for storing data SharedPreferences Store persistent key-value pairs that can be private or public Ideal for store preferences and other small data Files Local Storage – created in app sandbox and private External Storage – Open to be read by all applications SQLite Android provides full SQLite support Android provides SQLiteOpenHelper to manage opening and closing of actual database Ideal for storing structured data

Content Provider Content Provider Overview Content Provider Lifecycle Content Provider Lifecycle Explored Content Provider Sample Content Provider Callbacks Registering Content Provider

Content Providers share content with applications across application boundaries. Examples of built-in Content Providers are: Contacts MediaStore Settings and more Content Provider Overview

Content provider is initiated first time it is used via a call to onCreate(). There is no callback for cleaning up after the provider. When modifying the data (insert/update/delete), open/close database atomically. When reading the data, leave database open or else the data will get garbage collected. Content Provider Lifecycle

Registering in the manifest file:... <provider android:name=".ProviderDemo“ android:authorities="com.MSI.android.lifecycle.providerdemo" />... The authority of this provider must match the URI authority that this provider is responding to. Registering a Content Provider

Typical Use of Content Providers

Processes and Threading All components of the same application package run in the same process (all activities, services, etc). Android system automatically creates a thread called “main”, which is usually referred to as the “UI thread”. Any interaction with views (ui components) must be done from the UI thread. Android provides convenience classes for using background threads for long running tasks.

Threading - AsyncTask

Android applications are developed in Java. Decide on the API level that your app will be supporting. Each Android application runs in its own Application Security Sandbox Android system can kill your activity anytime if it decides its not required. Hence save your screen data constantly. Your application settings can be stored/retrieved using Preference Activity. You could register intent filters to start your activity or service from any other app. Services are the code that does not have UI. Use IntentService to perform any background activity. Broadcast Receiver listens to the system event to occur. Use a Content Provider if shared data access is required. Summary/Recap

DEVELOPMENT OPTIONS PAGE 42 Targeted for multiple device and OS development Web development skills recommended Recommended when no application programming desired and basic text data processing required Recommended when programmatically accessing MSI value adds is required for app development Recommended for standard Android development NEW

EMDK OFFERING PAGE 43 EMDK Scanning API MSR API PROFILES Scanning MSR Fusion Clock Power Battery Profile API Sample Apps / Code Settings Scanning MSR Eclipse IDE Android SDK + ADT //Get scanManager instance ScanManager scnDeviceMngr = (ScanManager)EMDKManager.getInstance (getApplicationContext(), SCANNER); //Enumerate scan devices ArrayList scnDevices = scnDeviceMngr.getDevices(); //Get specified scan device Device scnDevice = scnDevices.get(index); //Enable scan device scnDevice.enable(); //Set config ConfigurationSettings config = scnDevice.getConfiguration(); config.triggerMode = TriggerMode.SOFT_ONCE; config.Decoders.Code39 = ENABLE; …

THANK YOU