Top Banner
Android Overview For Managers Marko Gargenta Marakana
52

Android For Managers Slides

May 17, 2015

Download

Documents

Marko Gargenta

Marko's presentation on Android for Managers
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Android For Managers Slides

Android  Overview  For  Managers  

Marko  Gargenta  Marakana  

Page 2: Android For Managers Slides

ANDROID  HISTORY  

Page 3: Android For Managers Slides

History  2005   Google  buys  Android,  Inc.  

Work  on  Dalvik  starts  

2007   OHA  Announced  Early  SDK  

2008   G1  Announced  SDK  1.0  Released  

2009   G2  Released  Cupcake,  Donut,  Eclair  

Page 4: Android For Managers Slides

Android  and  Java  

Java EE

Java SE

Java MECDC

Java MECLDC

Java Source Code

Java Byte Code

Dalvik Byte Code

Java Compiler

Dex Compiler

Page 5: Android For Managers Slides

Android  Versus  Java  ME  Just one type of device – no CDC/CLDC

Easier to understand – no MIDlets, Xlets, AWT

Responsive – Dalvik vs. one–size-fits-all JVM

Java (in)compatibility

Adoption

Page 6: Android For Managers Slides

ANDROID  STACK  

Page 7: Android For Managers Slides

The  Stack  

Page 8: Android For Managers Slides

Linux  Kernel  Android runs on Linux.

Linux provides as well as: Hardware abstraction layer Memory management Process management Networking

Users never see Linux sub system

The adb shell command opens Linux shell

Linux Kernel

Libraries

Application Framework

Applications

Home Contacts Phone Browser Other

Activity Manager

Window Manager

ContentProviders

View System

PackageManager

TelephonyManager

Resource Manager

LocationManager

NotiicationManager

Surface Manager

OpenGL

SGL

Media Framework

FreeType

SSL

SQLite

WebKit

libc

Android Runtime

Core Libs

Delvik VM

DisplayDriver

KeypadDriver

CameraDriver

WiFiDriver

FlashDriver

AudioDriver

BinderDriver

PowerMgmt

Page 9: Android For Managers Slides

NaSve  Libraries  Native C libraries provide many of key Android services, such as:

Surface Manager, for composing window manager with off-screen buffering

2D and 3D graphics hardware support or software simulation

Media codecs offer support for major audio/video codecs

SQLite database

WebKit library for fast HTML rendering

Linux Kernel

Libraries

Application Framework

Applications

Home Contacts Phone Browser Other

Activity Manager

Window Manager

ContentProviders

View System

PackageManager

TelephonyManager

Resource Manager

LocationManager

NotiicationManager

Surface Manager

OpenGL

SGL

Media Framework

FreeType

SSL

SQLite

WebKit

libc

Android Runtime

Core Libs

Delvik VM

DisplayDriver

KeypadDriver

CameraDriver

WiFiDriver

FlashDriver

AudioDriver

BinderDriver

PowerMgmt

Page 10: Android For Managers Slides

Dalvik  Dalvik VM is Google’s implementation of Java

Optimized for mobile devices

Key Dalvik differences:

Register-based versus stack-based VM Dalvik runs .dex files More efficient and compact implementation Different set of Java libraries than SDK

Page 11: Android For Managers Slides

ApplicaSon  Framework  Activation manager controls the life cycle of the app

Content providers encapsulate data that is shared (e.g. contacts)

Resource manager manages everything that is not the code

Location manager figures out the location of the phone (GPS, GSM, WiFi)

Notification manager for events such as arriving messages, appointments, etc

Linux Kernel

Libraries

Application Framework

Applications

Home Contacts Phone Browser Other

Activity Manager

Window Manager

ContentProviders

View System

PackageManager

TelephonyManager

Resource Manager

LocationManager

NotiicationManager

Surface Manager

OpenGL

SGL

Media Framework

FreeType

SSL

SQLite

WebKit

libc

Android Runtime

Core Libs

Delvik VM

DisplayDriver

KeypadDriver

CameraDriver

WiFiDriver

FlashDriver

AudioDriver

BinderDriver

PowerMgmt

Page 12: Android For Managers Slides

ApplicaSons  

Page 13: Android For Managers Slides

Android  SDK  -­‐  What’s  in  the  box  

SDK

Tools Docs Platforms

Data Skins Images Samples

Add-ons Google Maps

Page 14: Android For Managers Slides

HELLO  WORLD!  

Page 15: Android For Managers Slides

Create  New  Project  Use the Eclipse tool to create a new Android project.

Here are some key constructs:

Project   Eclipse  construct  

Target   minimum  to  run  

App  name   whatever  

Package   Java  package  

AcSvity   Java  class  

Page 16: Android For Managers Slides

The  Manifest  File  <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.marakana" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon"

android:label="@string/app_name"> <activity android:name=".HelloAndroid" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="5" /> </manifest>

Page 17: Android For Managers Slides

The  Layout  Resource  

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>

Page 18: Android For Managers Slides

The  Java  File  

package com.marakana;

import android.app.Activity; import android.os.Bundle;

public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }

Page 19: Android For Managers Slides

Running  on  Emulator  

Page 20: Android For Managers Slides

MAIN  BUILDING  BLOCKS  

Page 21: Android For Managers Slides

AcSviSes  Android Application

Main Activity AnotherActivity

AnotherActivity

Activity is to an application what a web page is to a website. Sort of.

Page 22: Android For Managers Slides

AcSvity  Lifecycle  Starting

Running

PausedStopped

Destroyed

(1) onSaveInstanceState()(2) onPause()

(3) onResume()(2) onStart()

(1) onRestart() onResume()

(1) onSaveInstanceState()(2) onStop()

<process killed>

onDestroy()or

<process killed>

(1) onCreate()(2) onStart()

(3) onRestoreInstanceState()(4) onResume()

Activities have a well-defined lifecycle. The Android OS manages your activity by changing its state. You fill in the blanks.

Page 23: Android For Managers Slides

Intents  Android Application

AnotherActivity

Android Application

Main Activity

Intent

Intent

Main Activity

Intent AnotherActivity

Intents are to Android apps what hyperlinks are to websites. They can be implicit and explicit. Sort of like absolute and relative links.

Page 24: Android For Managers Slides

Services  A service is something that can be started and stopped. It doesn’t have UI. It is typically managed by an activity. Music player, for example

Page 25: Android For Managers Slides

Service  Lifecycle  Starting

RunningStopped

Destroyed

onStart()

onDestroy()or

<process killed>

(1) onCreate()(2) onStart()

onStop()

Service also has a lifecycle, but it’s much simpler than activity’s. An activity typically starts and stops a service to do some work for it in the background. Such as play music, check for new tweets, etc.

Page 26: Android For Managers Slides

Content  Providers  

Content Provider

Content URI

insert()

update()

delete()

query()

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

Page 27: Android For Managers Slides

ANDROID  USER  INTERFACE  

Page 28: Android For Managers Slides

Two  UI  Approaches  

Procedural   Declara@ve  

You  write  Java  code  Similar  to  Swing  or  AWT  

You  write  XML  code  Similar  to  HTML  of  a  web  page  

You can mix and match both styles. Declarative is preferred: easier and more tools

Page 29: Android For Managers Slides

XML-­‐Based  User  Interface  

Use WYSIWYG tools to build powerful XML-based UI. Easily customize it from Java. Separate concerns.

Page 30: Android For Managers Slides

Dips  and  Sps  

px  (pixel)   Dots  on  the  screen  

in  (inches)   Size  as  measured  by  a  ruler  

mm  (millimeters)   Size  as  measured  by  a  ruler  

pt  (points)   1/72  of  an  inch  

dp  (density-­‐independent  pixel)   Abstract  unit.  On  screen  with  160dpi,  1dp=1px  

dip   synonym  for  dp  and  oden  used  by  Google  

sp   Similar  to  dp  but  also  scaled  by  users  font  size  preference  

Page 31: Android For Managers Slides

Views  and  Layouts  

ViewGroup

ViewViewGroup

View View View

ViewGroups contain other Views but are also Views themselves.

Page 32: Android For Managers Slides

Common  UI  Components  

Android UI includes many common modern UI widgets, such as Buttons, Tabs, Progress Bars, Date and Time Pickers, etc.

Page 33: Android For Managers Slides

SelecSon  Components  

Some UI widgets may be linked to zillions of pieces of data. Examples are ListView and Spinners (pull-downs).

Page 34: Android For Managers Slides

Adapters  

To make sure they run smoothly, Android uses Adapters to connect them to their data sources. A typical data source is an Array or a Database.

Data Source

Adapter

Page 35: Android For Managers Slides

Complex  Components  Certain high-level components are simply available just like Views. Adding a Map or a Video to your application is almost like adding a Button or a piece of text.

Page 36: Android For Managers Slides

Building  UI  for  Performance  

A handy Hierarchy Viewer tool helps with optimizing the UI for performance

Page 37: Android For Managers Slides

Menus  and  Dialogs  

Page 38: Android For Managers Slides

Graphics  &  AnimaSon  

Android has rich support for 2D graphics. You can draw & animate from XML. You can use OpenGL for 3D graphics.

Page 39: Android For Managers Slides

OPERATING  SYSTEM  FEATURES    

Page 40: Android For Managers Slides

File  System  The file system has three main mount points. One for system, one for the apps, and one for whatever.

Each app has its own sandbox easily accessible to it. No one else can access its data. The sandbox is in /data/data/com.marakana/

SDCard is expected to always be there. It’s a good place for large files, such as movies and music. Everyone can access it.

Page 41: Android For Managers Slides

Preferences  

Your app can support complex preferences quite easily.

You define your preferences in an XML file and the corresponding UI and data storage is done for free.

Page 42: Android For Managers Slides

NoSficaSons  

Notifications are useful for applications to notify user of things going on in the background.

Notifications are implemented via Notification Manager.

Page 43: Android For Managers Slides

Security  

Android Application

PrefsDBFile

System

Linux Process

Each Android application runs inside its own Linux process.

Additionally, each application has its own sandbox file system with its own set of preferences and its own database.

Other applications cannot access any of its data, unless it is explicitly shared.

Page 44: Android For Managers Slides

SQLite  Database  Android ships with SQLite3

SQLite is

Zero configuration Serverless Single database file Cross-Platform Compact Public Domain

Database engine.

May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give.

Page 45: Android For Managers Slides

MulSmedia  AudioPlayer lets you simply specify the audio resource and play it.

VideoView is a View that you can drop anywhere in your activity, point to a video file and play it.

XML: <VideoView android:id="@+id/video" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center” />

Java: player = (VideoView) findViewById(R.id.video); player.setVideoPath("/sdcard/samplevideo.3gp"); player.start();

Page 46: Android For Managers Slides

Sensors  

Android supports many built-in sensors. You simply register with Sensor Manager to get notifications when sensor data changes.

Sensors are erratic and data comes in uneven intervals.

Emulator doesn’t have good support for sensors.

Page 47: Android For Managers Slides

Google  Maps  

Google Maps is an add-on in Android. It is not part of open-source project.

However, adding Maps is relatively easy using MapView.

XML: <com.google.android.maps.MapView android:id="@+id/map" android:clickable="true" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="0EfLSgdSCWIN…A" />

Page 48: Android For Managers Slides

WORKING  WITH  HARDWARE  

Page 49: Android For Managers Slides

Camera  Android SDK supports access to built-in Camera and its preview.

You can access real-time frames, or get a callback when shutter is open. The photo data is passed back in either raw or jpeg format.

Page 50: Android For Managers Slides

WiFi  WiFi API allows for managing your connection, scanning for active WiFi points and find out details about each.

Page 51: Android For Managers Slides

Telephony  

With Telephony API, you can:

Make phone calls Monitor phone state and activity Access phone properties and status Monitor data connectivity Control the phone

It is a simple yet powerful API

Page 52: Android For Managers Slides

Summary  Android is open Android is simple Android is complete Android has apps Android uses Java

Geeks love Android OEMs love Android Operators like Android

Android UI is not as sexy Android doesn’t have as many apps Android doesn’t have THE phone Yet.