Reminders Lab opens from today 

advertisement
Reminders
 Lab opens from today
 Wednesday 4:00-5:30pm, Friday 1:00-2:30pm
 Location: MK228
 Each student checks out one sensor mote for your Lab 1
 The TA will be there to help your lab work
 Many students want to use the extra I/O pins on
TelosB motes for projects
 Some information and tutorials has been posted on course
website
 Be careful on soldering work
ECE 455/555 Embedded System Design
1
ECE 455/555
Embedded System Design
Android Introduction
Wei Gao
Fall 2015
2
What is Android?
 Android is a software stack for mobile devices
that includes an operating system, middleware,
and key applications.
 http://developer.android.com/guide/basics/what-is-
android.html
 Android Software Development Kit (SDK)
 http://developer.android.com/sdk/index.html
 Provides the tools and APIs to begin developing applications on the
Android platform using Java.
 Includes a debugger, libraries, a handset emulator (based on QEMU),
documentation, sample code, and tutorials
ECE 455/555 Embedded System Design
3
What is Android?
 Google Play is an online software store developed by
Google for Android devices
 http://play.google.com
 Counterpart of Apple Store
 As of December 2010, the Android Market (precedent of
Google Play) had over 200,000 applications
 You can develop your program and publish it to the
world!
 Java programming given the Android APIs!
ECE 455/555 Embedded System Design
4
History
 Android mobile operating system initially developed
by Android Inc
 Android was bought by Google in 2005
 Google and other members of the Open Handset
Alliance collaborated on Android's development and
release
 Android has been available under a free software /
open source license since October, 2008
ECE 455/555 Embedded System Design
5
History
 Android versions
Improved performance, VM
support, and sensing APIs
New UI framework, graphics
and multi-core support
4G support, WiFi p2p
connections
ECE 455/555 Embedded System Design
6
Android Overview
 Hardware platform
 ARM architecture
 Powered by the Linux kernel v2.6
 Consists of 12 million lines of code including:
 3 million lines of XML
 2.8 million lines of C
 2.1 million lines of Java
 1.75 million lines of C++
 Comparing with TinyOS
ECE 455/555 Embedded System Design
7
Android System Architecture
Middleware
ECE 455/555 Embedded System Design
8
Middleware
 Software above the OS
 Provides services to (user) software applications
beyond those available from the OS
 Advantages of middleware
 Separate less important functionalities out from OS kernel
• “micro”-kernel
 Easier for developers to perform communication and I/O
• Better APIs
• More efficient resource management
• Easy debugging
ECE 455/555 Embedded System Design
9
Android Middleware
 Constraints on smartphones
 Processor capabilities
 Memory constraint
 Limited battery life
 Middleware provides system services in a more
efficient way
 Linux kernel in Android:
 Process management and scheduling
 Power management
 Hardware drivers
ECE 455/555 Embedded System Design
10
Android Middleware
 http://developer.android.com/about/versions/index.
html
 Application framework
 Direct APIs to application
 Window, user activity, resource, notifications, location
services
 Windows 7: everything in the system kernel
 Libraries
 WebKit, OpenGL, SSL, etc.
ECE 455/555 Embedded System Design
11
Android Middleware
 Android Runtime
 Davlik Virtual Machine: optimized for mobile devices
 Each application in Android runs as a separate
instance of Davlik virtual machine
 Expensive: 2-3 times slower than Java SE embedded
 Robust, reliable, and secure
• Each application runs as a separate process
• Linux permission is only given to the application itself
• Principle of least privilege
ECE 455/555 Embedded System Design
12
Android Application Components
 Activity: visual user interface
 Activities work together to form a cohesive user interface
 http://developer.android.com/guide/topics/fundamentals.
html
ECE 455/555 Embedded System Design
13
Android Application Components
 Service: runs in the background for an indefinite
period of time
 Comparable to Windows services
 Example: Media player’s music playback service
 Comparison: third-party background service is not
allowed on iPhone
 Concerns: system stability and cost, user security
ECE 455/555 Embedded System Design
14
Android Application Components
 Content provider
 Makes a specific set of the application's data available to
other applications
 Enables other applications to retrieve and store data of the
type it controls
 Interaction among applications: system call
 Any application can start another application’s
component
 Application launching camera/map applications
ECE 455/555 Embedded System Design
15
Android Application Components
 Broadcast receivers:
 System-wide event notification
• Screen turned on, radio on/off, battery low, etc.
 Application-specific broadcasts
• Status bar notification instead of user interface
ECE 455/555 Embedded System Design
16
ECE 455/555
Embedded System Design
Android SDK Installation
Wei Gao
Fall 2014
17
Development Environments
 Operating System
 Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7
(32- or 64-bit)
 Mac OS X 10.5.8 or later (Leopard, x86 only)
 Linux (tested on Ubuntu Linux, Lucid Lynx)
• GNU C Library (glibc) 2.7 or later is required.
• On Ubuntu Linux, version 8.04 or later is required.
• 64-bit distributions must be capable of running 32-bit applications
 IDE: Eclipse is recommended
 Make sure you use Eclipse IDE for Java Developers
 Eclipse JDT plug-in
 JRE & JDK 1.6 and above
ECE 455/555 Embedded System Design
18
Installation Steps
 http://developer.android.com/sdk/installing.html
 Install Java SDK
 Install Eclipse IDE
 Install Android SDK
 Installing ADT plug-in for Eclipse
 Adding Platforms and Components
ECE 455/555 Embedded System Design
19
Install Android SDK
 http://developer.android.com/sdk/index.html
 Android SDK manager
ECE 455/555 Embedded System Design
20
Install Android Developer Toolkit
(ADT) Plugins
ECE 455/555 Embedded System Design
21
Install Android Developer Toolkit
(ADT) Plugins
ECE 455/555 Embedded System Design
22
Install Android Developer Toolkit
(ADT) Plugins
ECE 455/555 Embedded System Design
23
Configure ADT Plugins
ECE 455/555 Embedded System Design
24
Configure ADT Plugins
ECE 455/555 Embedded System Design
25
Device Driver
 For you to upload the program onto the phone
 Windows
 Download and install the Google ADB driver here
 http://web.eecs.utk.edu/~weigao/ece455/fall2015/google
-adb-drivers.zip
 Mac OS X/Linux
 Read the instructions below
 http://developer.android.com/guide/developing/device.ht
ml
ECE 455/555 Embedded System Design
26
HelloWorld Demo
 Create an Android project
ECE 455/555 Embedded System Design
27
HelloWorld Demo
 Project properties:
ECE 455/555 Embedded System Design
28
HelloWorld Demo
 Edit MainActivity.onCreate()
ECE 455/555 Embedded System Design
29
HelloWorld Demo
 Connect the phone to USB
 Run the program as an Android application
 Eclipse automatically compile the program into a .apk file
and uploads it to the phone
 If you don’t have a phone connected, it will run on an
Android emulator
ECE 455/555 Embedded System Design
30
Android Emulator
 Automatically switch to emulator when no phone
device is connected
ECE 455/555 Embedded System Design
31
Download