Introduction to Android

Download Report

Transcript Introduction to Android

Introduction to Android
To help get us all up to speed when it is time to install the SDK please make sure
• Eclipse is installed (3.4 or higher) (32/64 bit all versions on CD)
• A current JDK is installed (Linux rpm, or Windows on CD, Mac sorry)
•You get a copy of the SDK installer (any OS) off one of the CDs being passed around (or the Jump
•You can copy the android-sdk folder if you are on a windows machine (2.1-2.3 packages already
Ross Hendrickson
SSID: SolidStateDepot
Pass: 2200Central
What we hope to do today
•
•
•
•
•
Go through a 10,000 foot overview of Android
Talk about Mobile development
Talk about key parts of building an Android App
Get the SDK up
Get Eclipse talking with your device or a virtual
one
• Get everyone building a hello world app
• If we get to it - a temperature converter app
History
•
•
•
•
•
2005 – Google Buys Android, Inc
2007 – Open Handset alliance announced
2008 – G1 Device released
2009 – Cupcake, Donut, Éclair
2010 – Android 2nd most sold
Android Overview
• Open Handset Alliance
– Dozens of Manufacturers, Carriers, Software
Companies
• Comprehensive (all in one)
– Developers, write once -> deploy to many devices
– Users, massive level of customization (if so desired)
• Entire OS Source Code available
• Why do we care? Why should we care?
• Why do manufacturers care?
Advantages of Android
•
•
•
•
•
Linux
Portability
Security
100 million devices May of 2011
550K activations daily
Why do we care?
Regardless of how the i-devices are doing
Android is still a big player in the mobile arena
Java Java and Android Java
Java Source Code
Java Source
Code
Java Compiler
Java Compiler
Java Byte Code
Java Byte Code
Dex Compiler
Java Byte Code
on Java VM
Dalvik Byte Code
Dalvik executable
on Dalvik VM
Native Libraries in Android
• Native Libraries
– Webkit
– SQLite
– Apache Harmony
– OpenGL
– OpenSSL
So where are we?
Important Android Building Blocks
• Activities - Represents the presentation layer of an Android
application, e.g. a screen which the user sees. An Android application
can have several activities and it can be switched between them
during runtime of the application.
• Intents - are asynchronous messages which allow the application
to request functionality from other services or activities. An
application can call directly a service or activity (explicit intent) or ask
the Android system for registered services and applications for an
intent (implicit intents).
Blocks cont’d
• Services - perform background tasks without providing
an UI. They can notify the user via the notification
framework in Android.
• Content Provider - provides data to applications, via a
content provider your application can share data with
other applications. Android contains a SQLite DB which
can serve as data provider
• Broadcast Receiver - receives system messages and
implicit intents, can be used to react to changed
conditions in the system. An application can register as
a broadcast receiver for certain events and can be
started if such an event occurs.
Alright, lets create something
Quick Start
ADT Plugin
1. Start Eclipse, then select Help > Install New Software....
2. Click Add, in the top-right corner.
3. In the Add Repository dialog that appears, enter "ADT Plugin"
for the Name and the following URL for the Location:
1. https://dl-ssl.google.com/android/eclipse/
2. Click OK
Note: If you have trouble acquiring the plugin, try using "http" in the Location
URL, instead of "https" (https is preferred for security reasons).
3. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
4. In the next window, you'll see a list of the tools to be downloaded. Click Next.
5. Read and accept the license agreements, then click Finish.
Note: If you get a security warning saying that the authenticity or validity of the
software can't be established, click OK..
6. When the installation completes, restart Eclipse.
Lets create a new Android Project
AndroidManifest.xml
XML buh bye
Activities
Activity Life Cycle
Main.xml, Strings, R.java etc.
USB Mania
Nexus One, G1, Ion, myTouch 3G, Droid, Nexus S
http://developer.android.com/sdk/win-usb.html
Everyone else
http://developer.android.com/sdk/oem-usb.html
Intents
• Anyone worked with Listeners?
• Explicit versus Implicit
Services
Content Provider
Broadcast Reciever
Temperature
www.savorywatt.com/uploads/temperature_handout.pdf