begining android development
DESCRIPTION
Presentasi Pengembangan Applikasi Android untuk pengguna Linux di OSCA (Open Source Community AKAKOM),Yogyakarta, 25 September 2011TRANSCRIPT
![Page 2: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/2.jpg)
Agenda
Introduction Android Architecture Application Development Demo
![Page 3: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/3.jpg)
What is Android?
● What is Android??● Android Features.
– Application framework
– Dalvik virtual machine
– Integrated browser
– Optimized graphics
– SQLite
– Media support
– GSM Telephony (hardware dependent)
– Bluetooth, EDGE, 3G, and WiFi (hardware dependent)
– Camera, GPS, compass, and accelerometer (hardware dependent)
– Rich development environment
![Page 4: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/4.jpg)
Agenda
Intro Android Architecture Application Development Demo
![Page 5: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/5.jpg)
Android Architecture
![Page 6: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/6.jpg)
Android Architecture
● Linux Kernel ● 2.6 -> core system
– Security,– memory management, – process management, – network stack, and – driver model.
![Page 7: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/7.jpg)
Android Architecture
● Library– System C library (libc)– Media Libraries - based
on PacketVideo's OpenCORE;
– Surface Manager– LibWebCore– SGL– 3D libraries– FreeType - bitmap and
vector font rendering– SQLite
![Page 8: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/8.jpg)
Android Architecture
● Android runtime– Dalvik VM– Not a Java VM
● register based
– one instance per application
– memory optimized– uses Linux to manage
memory and multi-threading
![Page 9: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/9.jpg)
Android Architecture
● Application Framework● Service and System
– Views
– Content providers
– Resource manager
– Notification manager
– Activity manager
● All Java classes● Simplify the reuse of
components● Any application can publish
its capabilities and any other application may then make use of those capabilities
![Page 10: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/10.jpg)
Android Architecture
● Applications● Core Applications
– email client, – SMS program, – calendar, – maps, – browser, – contacts, and others
● All applications are written using the Java programming language.
![Page 11: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/11.jpg)
Agenda
Intro Android Architecture Application Development Demo
![Page 12: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/12.jpg)
Development Environment
● Eclipse Based● Android SDK,
– http://developer.android.com/sdk/index.html● Android Development Tools (ADT) plugin for Eclipse
– http://developer.android.com/sdk/eclipse-adt.html● Emulator (AVD)
or● Target Devices
– USB Connection
![Page 13: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/13.jpg)
Development Environment
● Netbean Based● Android SDK,
– http://developer.android.com/sdk/index.html● Android plugin for Netbeans
– http://kenai.com/projects/nbandroid/downloads/download/updatecenter/updates.xml
● Emulator (AVD)or
● Target Devices– USB Connection
![Page 14: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/14.jpg)
Development Environment
● Command Line Based● Android SDK,
– http://developer.android.com/sdk/index.html● Ant + Bash + editor,● Emulator (AVD),
or● Target Devices
– USB Connection
Reference: http://developer.android.com/guide/developing/projects/projects-cmdline.html
![Page 15: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/15.jpg)
Development Environment
● Web Based (App Inventor)● Android SDK,
– http://developer.android.com/sdk/index.html● Web Browser,
– http://www.appinventorbeta.com● Emulator (AVD),
or● Target Devices
– USB Connection
![Page 16: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/16.jpg)
Programming Model
No single entry point – main()Run when needed.
![Page 17: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/17.jpg)
Programming Model
● Activity– Executable unit– Has UI– 1 application can have
multiple Activity● Services
– Similar to Activity– No UI– Run in Background
● Content Providers– Makes application's data
available to other– Can be:
● File system,● Database (SQLite)● Other
– Targeted by: ContentResolver
● Broadcast Receiver– Respond to broadcast
messages.
● Application Components
![Page 18: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/18.jpg)
Where is the Tools?
● android
● Dalvik Debug Monitor Server (ddms)
● dmtracedump
● Draw 9-patch
● Android Emulator (emulator)
● Hierarchy Viewer (hierarchyviewer)
● hprof-conv
● layoutopt
● mksdcard
● Monkey
● monkeyrunner
● ProGuard
● sqlite3
● traceview
● zipalign
![Page 19: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/19.jpg)
Agenda
Intro Android Architecture Application Development Demo
![Page 20: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/20.jpg)
Lets try to Develop.
![Page 21: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/21.jpg)
How do I create some Project?
Which one? Eclipse Based,
or
Command Line
![Page 22: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/22.jpg)
Android + Eclipse
![Page 23: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/23.jpg)
Android + Bash (Ant)
Requirement:● Ant● Shell / Bash
atau
![Page 24: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/24.jpg)
Create a Project.
Run in terminal:
$ android create project \
target <target> \
name <project name> \
path <path to project> \
activity <activity name> \
package <package name>
Example:
$ android create project \
target 7 \
name CobaAndroid \
path ./CobaAndroid \
activity CobaActivity \
package com.android.main
![Page 25: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/25.jpg)
Project Structure
└── CobaAndroidProject
├── AndroidManifest.xml
├── bin
├── build.properties
├── build.xml
├── default.properties
├── libs
├── local.properties
├── proguard.cfg
├── res
│ ├── drawablehdpi
│ │ └── icon.png
│ ├── ...
│ ├── layout
│ │ └── main.xml
│ └── values
│ └── strings.xml
└── src
└── com
└── android
└── main
└── CobaAndroidActivity.java
![Page 26: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/26.jpg)
Running it...
Just type:
$ emulator avd <avd_name> &
[wait a moment]
$ ant install
$ adb shell 'am start n <package.name>/.<ActivityName>'
![Page 27: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/27.jpg)
Debugging it...
Run from terminal:
$ ddms
![Page 28: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/28.jpg)
Deployment
● Debug● Target: Development
● Release● Target: Market● Unsigned● Signed (for Market)
![Page 29: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/29.jpg)
Where I can learn it?
http://www.anddev.org
http://www.vogella.de/
http://stackoverflow.com/questions/tagged/android
![Page 30: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/30.jpg)
And the last one....
![Page 31: Begining Android Development](https://reader034.vdocuments.site/reader034/viewer/2022052410/555801f1d8b42ae31c8b4ee8/html5/thumbnails/31.jpg)
What happen if:
SL4A