SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

Scala quick start
Scala quick startScala quick start
Scala quick startSukjin Yun
 
Distributed Eventing in OSGi - Carsten Ziegeler
Distributed Eventing in OSGi - Carsten ZiegelerDistributed Eventing in OSGi - Carsten Ziegeler
Distributed Eventing in OSGi - Carsten Ziegelermfrancis
 
Writing Better Haskell
Writing Better HaskellWriting Better Haskell
Writing Better Haskellnkpart
 
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 MySQLAndrew Hutchings
 
"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
 

La actualidad más candente (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" Евгений Бобров
 

Similar a Android app development: a top-down perspective

Introduction to Android Development and Security
Introduction to Android Development and SecurityIntroduction to Android Development and Security
Introduction to Android Development and SecurityKelwin Yang
 
Android application development
Android application developmentAndroid application development
Android application developmentslidesuren
 
Android Development
Android DevelopmentAndroid Development
Android Developmentmclougm4
 
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 projectSiva Kumar reddy Vasipally
 
Session 2 prepare android development environment
Session 2   prepare android development environmentSession 2   prepare android development environment
Session 2 prepare android development environmentAdham Enaya
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions newJoe Jacob
 
Android Application WebAPI Development Training
Android Application WebAPI Development TrainingAndroid Application WebAPI Development Training
Android Application WebAPI Development TrainingOESF Education
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Javaamaankhan
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
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 DevelopmentAhsanul Karim
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Ahsanul Karim
 
Introduction to android basics
Introduction to android basicsIntroduction to android basics
Introduction to android basicsHasam Panezai
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1Purvik Rana
 
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 ApplicationNandini Prabhu
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows DevelopersYoss Cohen
 

Similar a 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
 

Último

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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 FresherRemote DBA Services
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

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