android
play

Android Michael Greifeneder Image source: Android homepage Inhalt - PowerPoint PPT Presentation

Android Michael Greifeneder Image source: Android homepage Inhalt Overwiew Hardware Software Development Tools Basics Debugging/Emulator Location Demo Android And Me Why I like Android Blend of Linux


  1. Android Michael Greifeneder Image source: Android homepage

  2. Inhalt ● Overwiew ● Hardware ● Software ● Development ● Tools ● Basics ● Debugging/Emulator ● Location ● Demo

  3. Android And Me ● Why I like Android ● Blend of Linux and Java ● Open (Source) ● Development on Ubuntu :) ● USB mass storage ● Tethering (USB, Wifi) ● Don't like ● Battery life ● Default LookNFeel

  4. Hardware ● Typically ARM processors, up to 1 GHz ● 256-512 MB RAM, up to 1 GB ROM ● Connectivity: GSM/EDGE, UMTS, Bluetooth, Wi-Fi, and WiMAX. ● Cameras, GPS, accelerometers, SD card ● Optional physical keyboard ● ~34 devices... Image sources: Device manufacturer

  5. Smartphone Sales Stats Forecast 2010 North America ● North America 3,4 3,1 4,7 ● Source: Canalys Symbian RIM 12,3 Apple ● Total: 65 Mio Google Microsoft 28 Palm ● Worldwide 1Q10 ● Source: Gartner 13,8 Q1 Worldwide ● Total: 54 Mio/Q 1Q10 Worldwide Sales 18 0,7 3,7 6,8 16 14 9,6 12 Symbian Research In Motion 10 Android iPhone OS iPhone 44,3 8 Android Microsoft Windows 6 Mobile Linux 15,4 4 Other OSs 2 0 2008 2009 2010 19,4 http://www.gartner.com/it/page.jsp?id=1372013 http://www.gartner.com/it/page.jsp?id=985912

  6. Markets ● Google's Android Market (>50.000 Apps) ● 25$ one-time registration ● No restrictions ● Alternatives available (android.pdassi.de) ● Just click on an .apk file... http://xkcd.com/662/ Creative Commons Attribution-NonCommercial 2.5 License.

  7. Software ● Tweaked Linux kernel (2.6.27-32) ● No X Window System ● Dalvik/Java Runtime ● register-based architecture ● .dex format ● dx tool convert .class files to .dex ● Neither AWT, Swing nor JavaME supported ● JIT implementation (Android 2.2) ● Open Source (Apache license)

  8. http://developer.android.com/guide/basics/what-is-android.html Architecture

  9. http://android.git.kernel.org/ Kernel From Kevin Mcdonagh slides: http://www.scribd.com/doc/31664622/Android-Source-Code-Guided-Tour

  10. Image source: Android homepage Versions ● Cupcake ● 1.5 (API 3) ● Donut ● 1.6 (API 4) ● Eclair ● 2.0 (API 5), 2.0.1 (API 6) +2.1 (API 7) ● FroYo (Frozen Yoghurt) ● 2.2 (API 8)

  11. Development ● Android SDK → http://developer.android.com/sdk ● ● Eclipse + Android Development Tools ● https://dl-ssl.google.com/android/eclipse/ ● Java+XML ● C/C++ for NDK Image source: Self-made screenshots

  12. Toolset ● adb (Android Debug Bridge) ● Installing an Application ● Copying Files to or from Device/Emulator ● Remote Shell ● z.B. Sqlite command-line ● DDMS (Dalvik Debug Monitor Server) ● Uses adb ● middleman btw. IDE + applications ● logcat

  13. Emulator ● Android Virtual Devices (AVD) ● hardware profile ● mapping to a system image ● dedicated storage area ● Emulator runs AVDs ● Emulates: Calls, SMS ● Location, Camera ● Network-speed Image source: Self-made screenshots

  14. Widgets ● Layout in XML files ● Layouts: LinearLayout, RelativeLayout, FrameLayout, TableLayout, AbsoluteLayout(pfui) ● Basic Widgets: TextView, Button, EditText, ImageView ● DatePicker, TimePicker, Tabs ● OptionMenu, ContextMenu ● WebView (WebKit) Image source: Self-made screenshots

  15. GUI Designer? ● Android Layout Editor in Eclipse ● Forget it. ● DroidDraw http://www.droiddraw.org/ ● Yeah, but... Image source: Self-made screenshots

  16. Project Structure ● AndroidManifest.xml ● /src ● /res ● /layout ● /menu ● /drawable ● /gen ● /values/strings.xml

  17. Security ● User must confirm access ● Declare required permissions in AndroidManifest.xml ● <uses-permission android:name= "android.permission.INTERNET"/ > ● <uses-permission android:name= "android.permission. ACCESS_FINE_LOCATION" /> ● <uses-permission android:name= "android.permission.CAMERA" /> Image source: http://www.taosoftware.co.jp/en/android/wakeupcallmaker/

  18. Activities <--> Intents ● Activity = One screen ● Intents (abstract description of an operation) ● Explicit intents (same app) ● Implicit intents (inter App operation) ● Example: ● Action: Intent.ACTION_DIAL ● Data: ”tel:01567890” ● Intent filters ● Declare receiving of intents

  19. Activity ● Methods ● onCreate ● setContentView(R.layout.XML_FILE); ● findViewById(R.id.ID_IN_LAYOUT); ● onDestroy/onPause/onResume ● Call internal activity ● Intent intent = new Intent(this, OtherActivity.class); startActivity(intent); //or startActivityForResult(intent, 1);

  20. The Mighty List ● android.widget.ListView (ListActivity) ● ListAdapter for data ● Indiviual layout for row ● ArrayAdapter one Textview in row ● SimpleCursorAdapter ● Maps DB columns to resource ids in row layout Image source: Self-made screenshots

  21. Services... ● Use case ● Background tasks ● Long running tasks ● Implement a service ● AndroidManiferst.xml <service android:name=".MyService" /> ● onCreate/onStart/onDestroy ● onBind() → return a subclassed Binder that extends Binder and implements custom method: getService()

  22. Use Service (local) ● Intent intent = new Intent(this. Service.class) ● bindService(intent, serviceConnection, 0); ● interface ServiceConnection { onServiceConnected(Binder binder,...) onServiceDisconnected(...)} ● ((LocalBinder) binder).getService()

  23. Location aware ● LocationManager ● getLastKnownLocation ● Register for periodic updates ● Get notified on location ● Emulator ● Open console ● telnet localhost <5554?> ● geo fix <longitude> <latitude>

  24. Demos ● DB query ● Location (Change location in emulator) ● Camera ● Intent: android.media.action.IMAGE_CAPTURE is buggy ● http://code.google.com/p/android/issues/detail?id=1480 ● Workaround: Do it yourself ● Internet <uses-permission android:name="android.permission.INTERNET"/> ●

  25. Source code: http://github.com/mikegr/aLogMyNight eBooks: http://commonsware.com/books ??? Questions/Discussion ???

Recommend


More recommend