Androidoscon20080721 1216843094441821-9
-
Upload
gustavo-fuentes-zurita -
Category
Documents
-
view
472 -
download
0
Transcript of Androidoscon20080721 1216843094441821-9
![Page 1: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/1.jpg)
Getting started withGoogle Android
Sean SullivanJuly 21, 2008
![Page 2: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/2.jpg)
Topics
• Android platform
• Developer tools
• Android programming
![Page 3: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/3.jpg)
Android
November 5, 2007
![Page 4: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/4.jpg)
What is Android?
“Android is a software stack for mobile devices that includes an operating system, middleware and key applications”
![Page 5: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/5.jpg)
The Big Picture
![Page 6: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/6.jpg)
Android applications
• are written in the Java language
• run on the Dalvik virtual machine
![Page 7: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/7.jpg)
Dalvik VM
• not a Java VM
• design constraints: slow CPU, little RAM
• will run on OS without swap space
• http://sites.google.com/site/io/dalvik-vm-internals
![Page 8: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/8.jpg)
Application API’s
J2SE
java.util.* java.io.*
java.lang.*etc
UIandroid.widget.*android.view.*
android.graphics.*
Telephony android.telephony.IPhone
SMS android.telephony.gsm.SmsManager
![Page 9: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/9.jpg)
Application API’s
Web android.webkit.WebView
Camera android.hardware.CameraDevice
Local database android.database.*
Maps com.google.android.maps.MapView
Location android.location.LocationManagerMultimedia android.media.MediaPlayer
HTTP org.apache.http.client.*
![Page 10: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/10.jpg)
Demo
![Page 11: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/11.jpg)
Getting started
http://code.google.com/android
![Page 12: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/12.jpg)
Development tools
• Android SDK
• Eclipse plugin
![Page 13: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/13.jpg)
Android SDK
• Android emulator
• command line tools
• documentation
• example applications
![Page 14: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/14.jpg)
Command line tools
• aapt - Android asset packaging tool
• adb - Android debug bridge
• aidl - Android IDL compiler
• emulator - Android emulator
![Page 15: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/15.jpg)
Android emulator
![Page 16: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/16.jpg)
Android emulator
![Page 17: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/17.jpg)
Emulator limitations
• No support for placing or receiving actual phone calls
• No support for camera/video capture (input)
• No support for audio input
• No support for determining connected state
• No support for determining battery charge level
• No support for Bluetooth
![Page 18: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/18.jpg)
Eclipse plugin
https://dl-ssl.google.com/android/eclipse/
![Page 19: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/19.jpg)
Android applications
• application package file: myapp.apk
• an application is composed of one or more activities
![Page 20: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/20.jpg)
Activity
• an activity is usually a single screen in your application
• however, activities can also be faceless
• one activity is designated as the entry point for your application
![Page 21: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/21.jpg)
android.app.Activity
import android.app.Activity;
public class MyActivity extends Activity { public void onCreate(Bundle savedValues) { super.onCreate(savedValues); setContentView(R.layout.main); }
}
![Page 22: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/22.jpg)
Application building blocks
• AndroidManifest.xml
• Activities
• Views
• Layouts
• Intents & IntentReceivers
• Services
• Notifications
• ContentProviders
![Page 23: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/23.jpg)
Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.my_domain.app.helloactivity"> <application android:label="@string/app_name"> <activity android:name=".HelloActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> </manifest>
AndroidManifest.xml
![Page 24: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/24.jpg)
Implementing yourapplication UI
• Java code
• XML
![Page 25: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/25.jpg)
Android UI: XML
<?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="Hello World" /></LinearLayout>
![Page 26: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/26.jpg)
Android UI: Views
• an object that knows how to draw itself on the screen
• examples:
• android.widget.ListView
• android.widget.DatePicker
• android.widget.Button
• android.widget.ImageView
![Page 27: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/27.jpg)
Intents
• “an Intent is a simple message object that represents an ‘intention’ to do something”
• “an intent is an abstract description of an operation to be performed”
![Page 28: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/28.jpg)
android.content.Intent
• VIEW_ACTION
• EDIT_ACTION
• PICK_ACTION
• WEB_SEARCH_ACTION
• SYNC_ACTION
• ...
![Page 29: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/29.jpg)
Application Context
• startActivity(Intent)
• getSystemService
• createDatabase
• openDatabase
• deleteDatabase
• ...
android.app.ApplicationContext
![Page 30: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/30.jpg)
Additional topics• Threading
• Security model
• Internationalization
• Power management
• AIDL - Android IDL
• Data synchronization
• API for WiFi
![Page 31: Androidoscon20080721 1216843094441821-9](https://reader033.fdocuments.in/reader033/viewer/2022060107/554997cfb4c9050c738b46f2/html5/thumbnails/31.jpg)
Android resources
• http://code.google.com/android/
• http://android-developers.blogspot.com
• http://code.google.com/p/apps-for-android/
• http://sites.google.com/site/io/
• http://www.openhandsetalliance.com/
• http://git.android.com