Android … Developer Intro

  • 770 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
770
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
50
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Android Developer Introduction Eric Faccer eric.faccer@gmail.com Tricorder
  • 2. Presentation Overview • Dream/ADP1 Handset Overview • The Android SDK • The Android Software Stack • Advanced Concepts • Web Resources
  • 3. HTC Dream • Qualcomm ARM based CPU • Camera • Accelerometer • GPS, Digital Compass • WIFI, Bluetooth • TouchScreen • 3D Graphics
  • 4. Other Devices • Openmoko FreeRunner • Motorola A1200 Ming • HTC Vogue • HTC Touch • Nokia N810 • Nokia 770 • Asus EEEPC 701 • Asus EEEPC 1000H • Always Innovating Touch Book • Dell Axim x51v
  • 5. Open Handset Alliance • Mobile Phone Consortium dedicated to open standards for mobile devices. • Google, HTC, Intel, Samsung, Motorola, Qualcomm, T-Mobile, Sprint Nextel, Nvidia, Sony Ericsson, Vodaphone, ARM Holdings, Asustek, Toshiba, Garmin. • Nokia has hedged their bets and reportedly has a large team working on android.
  • 6. What is Android • Custom Linux Distribution and Java-based Virtual Machine • Based on the Java language 1.5 standard • Java is an overloaded term. It refers to: – A language with a distinct syntax/grammar – A class library – A stack based virtual machine • Android has implemented their own VM called Dalvik. Dalvik is different because it uses a register based VM architecture. • The practical consequence of the decision to drop the Java VM is standard java classes cannot be used on android without conversion.
  • 7. What is Android
  • 8. SDK Demo & Tools Overview • Eclipse Plugin • DDMS • HierarchyViewer • Activitycreator • Aapt Tool • Dx
  • 9. Activity class • Roughly corresponds to a single “screen” • Your application’s entry point. • Does not require a user interface, but that would be atypical. • When a new screen opens, the previous screen is paused and put onto a history stack. The user can then navigate backwards through previously opened screens in the history. Screens can also be removed from the history stack when it would be inappropriate for them to remain.
  • 10. Service class • Application component that runs in the background, for an indefinite period of time. • OpenBinder – System Level IPC and Component Framework • Local Services and Remote Services • Remote Services require using aidl and Parcelable classes
  • 11. Activity or Service Blocking • Use Threads liberally. • If your application or service blocks, the ActivityManager will come over and throw up a nasty ANR error for Application Not Responding. • If you start getting these, you know what to do.
  • 12. AndroidManifest.xml • A means for publishing application metadata Service Registration: <service android:name= "org.tricorder.android.TableService" /> Permissions: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> Intent-Filters: <intent-filter> <action android:name="org.tricorder.android.generic.service.ITrackerService"/> <action android:name="org.tricorder.android.generic.service.REMOTE_SERVICE"/> </intent-filter>
  • 13. Intent class • An intent is a description of an operation to be performed. • It can be used with Activity.startActivity() to launch an Activity or Context.BindService() to communicate with a Service. It can be broadcast system-wide to send it to any interested BroadcastReceiver components
  • 14. Intent Example Intent myIntent = new Intent( android.content.Intent.ACTION_VIEW, Uri.parse("geo:38.899533,-77.036476") ); startActivity(myIntent); Will open up the Maps Activity with the specified coordinates.
  • 15. Resources • Android SDK apps have no access to the underlying filesystem (except /sdcard) • Resources are build time artifacts (files) that are included in your application package. res/drawable – for images png/jpg, etc. res/layout – for xml layout files res/menu – for xml based menu specifications res/values – for strings, dimensions, etc. res/anim – for animations res/raw – for raw files
  • 16. BroadcastReceiver • A means to respond to system level events • The interface consists of a single method: onReceive() { } • To use in your Activity: • registerReceiver() in your Activity’s onResume() callback • unRegisterReceiver() in your Activity’s onPause() method • You can’t use it as an arbitrary message bus, because it will miss messages when the it’s Activity is inactive. • This holds even if you fail to unregister the receiver. Unregistering the receiver is merely good practice that reduces the system overhead by a small amount.
  • 17. Content Provider • A means for sharing tabular data across applications • It is a class that implements a standard set of methods to let other applications store and retrieve the type of data that is handled by that content provider. • Uses sqlite backend for relational data storage
  • 18. Android User Interface • May be defined using XML files or by writing standard java code • XML Caveats – The XML parser and renderer have a lot of bugs. This crashes eclipse alot. <?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="wrap_content" android:layout_height="wrap_content“ android:text="Hello World"/> </LinearLayout> HINT: USE WRAP_CONTENT! WYSIWYG tool at droiddraw.org
  • 19. Layouts • FrameLayout – contains a single object • LinearLayout – aligns all children in a single direction • TableLayout – positions its children into rows and columns • AbsoluteLayout – absolute positioning RelativeLayout – children specify their position relative to the parent view or to each other
  • 20. Handling UI events • Handle events the standard way: • EventListeners – onClick() • EventHandlers – onTouchEvent(MotionEvent)
  • 21. Crossing Things Off of Lists Credit: Jeff Sharkey http://www.jsharkey.org/blog
  • 22. Further Reading • http://developer.android.com • http://android-dls.com/wiki/ • http://anddev.org • #android, #android-dev on irc.openprojects.net • http://source.android.com
  • 23. Advanced Concepts • http://www.v6pc.jp/apc/en/data/addressing .pdf • http://www.open802.11s.org • http://www.quagga.net/about.php