SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Android Applications: A top-
down perspective
Chao-Chueh Chang
Outline
• Development environment
• Components of an Android application
• Debugging
Architecture of Android
Java
C/C++
C
JNI
Development Environment
• Java development kit (version 1.6 or higher)
• Android SDK
– Java classes for Android components
• IDE
– Google recommends Eclipse 3.4 or 3.5
• Android Development Tool (ADT) for Eclipse
• Android NDK (optional)
– Tool chain for compiling C/C++ into shared object
files
Installing ADT/SDK/NDK
• Installing ADT in Eclipse
– Start Eclipse, then select Help > Install New Software
– In the Available Software dialog, click Add...
• In the Add Site dialog that appears, enter this URL in the
"Location" field.
– https://dl-ssl.google.com/android/eclipse/
• Or download the ADT plugin zip file and click Archive in the
Available Software dialog
– Next, next, next…
• Configuring the Android SDK
– Run Android SDK manager and download “SDK Platform”
– Select Window > Preferences > Android
– Browse and select your SDK directory
• Add /path/to/your/ndk/directory/ to $PATH
Initializing a Project
• File -> New -> Android Application Project
• Helloworld!
Application Components
• Application properties: AndroidManifest.xml
– Presents essential information about the application
• Resource xml files ( /res)
– View layout, images, sounds, and etc…
• Generated code ( /gen)
– ADT generates a java file that includes resources and
the corresponding ID
• Source code ( /src , /jni )
– Generates shared object files through NDK
– Generates .class files through eclipse
• Object files ( /obj), Library files ( /libs)
Generating Application
Resource
files
R.java
*.java
*.class *.dex
.apk
AndroidManifest
C/C++ files *.so
Android Key Components
• Activity
– UI
– One activity at a time
• Service
– May continue working even the application is not in the
foreground
– Expose method interface to Activity (like Java RMI)
• Broadcast receiver
– Listen to specific action(s)
– IPC
• Content provider
– SQL-like
Activity Lifecycle
• onCreate()
– Set up activity layout
• onStart()
– Set event listener
– Run methods
– Initialize service or
BroadcastReceiver
• onStop()
– Do cleaning methods
Service Lifecycle
• onStart()
– Initializing threads
• onBind()
– Passing parameters to
this instance
Broadcast Receiver
1. Initialize IntentFilter
2. add actions
3. Initialize
BroadcastReceiver and
overrides onReceive
4. register
5. unregister
IntentFilter filter = new
IntentFilter();
Filter.addAction(WifiManager.
WIFI_STATE_CHANGED_ACTION);
BroadcastReceiver br = new
BroadcastReceiver(){
onReceive(){
…
}
};
registerReceiver(br, filter);
unregisterReceiver( br );
Compiling Codes Through NDK
• Claim native methods in Java
• Generates JNI header by javah
• Write C/C++ program
• Android.mk
– include $(BUILD_SHARED_LIBRARY)
• ndk-build
Android Virtual Device
• Simulating events
– Incoming calls, SMS…
• No support for the following items
– placing or receiving actual phone calls
– USB connections
– camera/video capture (input)
– device-attached headphones
– determining connected state
– determining battery charge level and AC charging state
– determining SD card insert/eject
– Bluetooth
Debugging Tools
• sdk/platform-tool/adb
– adb logcat
– ADT in Eclipse
• addr2line, objdump, readelf

Weitere ähnliche Inhalte

Was ist angesagt?

"Walk in a distributed systems park with Orleans" Евгений Бобров
"Walk in a distributed systems park with Orleans" Евгений Бобров"Walk in a distributed systems park with Orleans" Евгений Бобров
"Walk in a distributed systems park with Orleans" Евгений Бобров
Fwdays
 

Was ist angesagt? (6)

Scala quick start
Scala quick startScala quick start
Scala quick start
 
Distributed Eventing in OSGi - Carsten Ziegeler
Distributed Eventing in OSGi - Carsten ZiegelerDistributed Eventing in OSGi - Carsten Ziegeler
Distributed Eventing in OSGi - Carsten Ziegeler
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad PečanacJavantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
 
Writing Better Haskell
Writing Better HaskellWriting Better Haskell
Writing Better Haskell
 
libAttachSQL, The Next-Generation C Connector For MySQL
libAttachSQL, The Next-Generation C Connector For MySQLlibAttachSQL, The Next-Generation C Connector For MySQL
libAttachSQL, The Next-Generation C Connector For MySQL
 
"Walk in a distributed systems park with Orleans" Евгений Бобров
"Walk in a distributed systems park with Orleans" Евгений Бобров"Walk in a distributed systems park with Orleans" Евгений Бобров
"Walk in a distributed systems park with Orleans" Евгений Бобров
 

Ähnlich wie Android app development: a top-down perspective

Android application development
Android application developmentAndroid application development
Android application development
slidesuren
 
Session 2 prepare android development environment
Session 2   prepare android development environmentSession 2   prepare android development environment
Session 2 prepare android development environment
Adham Enaya
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
Joe Jacob
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
Ahsanul Karim
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows Developers
Yoss Cohen
 

Ähnlich wie Android app development: a top-down perspective (20)

Introduction to Android Development and Security
Introduction to Android Development and SecurityIntroduction to Android Development and Security
Introduction to Android Development and Security
 
Android application development
Android application developmentAndroid application development
Android application development
 
Android Development
Android DevelopmentAndroid Development
Android Development
 
ANDROID PPT 1.pdf
ANDROID PPT 1.pdfANDROID PPT 1.pdf
ANDROID PPT 1.pdf
 
01 04 - android set up and creating an android project
01  04 - android set up and creating an android project01  04 - android set up and creating an android project
01 04 - android set up and creating an android project
 
Session 2 prepare android development environment
Session 2   prepare android development environmentSession 2   prepare android development environment
Session 2 prepare android development environment
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
 
Android
AndroidAndroid
Android
 
Android Application WebAPI Development Training
Android Application WebAPI Development TrainingAndroid Application WebAPI Development Training
Android Application WebAPI Development Training
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3
 
Session 2 beccse
Session 2 beccseSession 2 beccse
Session 2 beccse
 
Introduction to android basics
Introduction to android basicsIntroduction to android basics
Introduction to android basics
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android Application
 
Android Programming
Android ProgrammingAndroid Programming
Android Programming
 
Unit I- ANDROID OVERVIEW.ppt
Unit I- ANDROID OVERVIEW.pptUnit I- ANDROID OVERVIEW.ppt
Unit I- ANDROID OVERVIEW.ppt
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows Developers
 

KĂźrzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
Christopher Logan Kennedy
 

KĂźrzlich hochgeladen (20)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Android app development: a top-down perspective

  • 1. Android Applications: A top- down perspective Chao-Chueh Chang
  • 2. Outline • Development environment • Components of an Android application • Debugging
  • 4. Development Environment • Java development kit (version 1.6 or higher) • Android SDK – Java classes for Android components • IDE – Google recommends Eclipse 3.4 or 3.5 • Android Development Tool (ADT) for Eclipse • Android NDK (optional) – Tool chain for compiling C/C++ into shared object files
  • 5. Installing ADT/SDK/NDK • Installing ADT in Eclipse – Start Eclipse, then select Help > Install New Software – In the Available Software dialog, click Add... • In the Add Site dialog that appears, enter this URL in the "Location" field. – https://dl-ssl.google.com/android/eclipse/ • Or download the ADT plugin zip file and click Archive in the Available Software dialog – Next, next, next… • Configuring the Android SDK – Run Android SDK manager and download “SDK Platform” – Select Window > Preferences > Android – Browse and select your SDK directory • Add /path/to/your/ndk/directory/ to $PATH
  • 6. Initializing a Project • File -> New -> Android Application Project • Helloworld!
  • 7. Application Components • Application properties: AndroidManifest.xml – Presents essential information about the application • Resource xml files ( /res) – View layout, images, sounds, and etc… • Generated code ( /gen) – ADT generates a java file that includes resources and the corresponding ID • Source code ( /src , /jni ) – Generates shared object files through NDK – Generates .class files through eclipse • Object files ( /obj), Library files ( /libs)
  • 9. Android Key Components • Activity – UI – One activity at a time • Service – May continue working even the application is not in the foreground – Expose method interface to Activity (like Java RMI) • Broadcast receiver – Listen to specific action(s) – IPC • Content provider – SQL-like
  • 10. Activity Lifecycle • onCreate() – Set up activity layout • onStart() – Set event listener – Run methods – Initialize service or BroadcastReceiver • onStop() – Do cleaning methods
  • 11. Service Lifecycle • onStart() – Initializing threads • onBind() – Passing parameters to this instance
  • 12. Broadcast Receiver 1. Initialize IntentFilter 2. add actions 3. Initialize BroadcastReceiver and overrides onReceive 4. register 5. unregister IntentFilter filter = new IntentFilter(); Filter.addAction(WifiManager. WIFI_STATE_CHANGED_ACTION); BroadcastReceiver br = new BroadcastReceiver(){ onReceive(){ … } }; registerReceiver(br, filter); unregisterReceiver( br );
  • 13. Compiling Codes Through NDK • Claim native methods in Java • Generates JNI header by javah • Write C/C++ program • Android.mk – include $(BUILD_SHARED_LIBRARY) • ndk-build
  • 14. Android Virtual Device • Simulating events – Incoming calls, SMS… • No support for the following items – placing or receiving actual phone calls – USB connections – camera/video capture (input) – device-attached headphones – determining connected state – determining battery charge level and AC charging state – determining SD card insert/eject – Bluetooth
  • 15. Debugging Tools • sdk/platform-tool/adb – adb logcat – ADT in Eclipse • addr2line, objdump, readelf