SlideShare uma empresa 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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" Евгений Бобров
 

Semelhante 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
 

Semelhante 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

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
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Último (20)

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
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

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