SlideShare une entreprise Scribd logo
1  sur  34
Architecture your Android Application Mark Brady
Structure ,[object Object]
10 Minutes of Q&A
Source Code: http://github.com/zedray/Android-Framework-Prototype/
Market App Framework Prototype [BETA]
About Me ,[object Object]
Android developer at Vodafone
Background in web design, back-end development and Java ME
Android Blog: http://blog.zedray.com/category/android/ “ Quick Dial / Call Log Widget”
Overview ,[object Object]
[object Object],[object Object]
Lack of guidance on how to use them. Service Application Activity
Activity #1 ,[object Object],1 2 3 4 Home Screen
Activity #2 ,[object Object],3 4 Bundle Bundle
Activity #3 ,[object Object],Bundle Bundle 2 3 4
Activity #4 ,[object Object]
Running onStart() - onStop()
Finishing onStop() and onDestroy() may not be called if a process is killed (i.e. due to low memory)
Activity #5 ,[object Object]
Do long running work in AsyncTask Separate non-UI thread will avoid ANR error.
Activity #6 ,[object Object]
Code from multiple activities can be running in the background. No good definition for when an application  has finished .
[object Object],[object Object],Time 1 2 3 4 3
[object Object],[object Object],Long running services invite “Service Killer” applications. Time
[object Object],[object Object],Time UI Broadcast Receiver
[object Object],[object Object],Think about “User Goals” during your design.
[object Object],[object Object],Old execution model, i.e. not very Android . Application 1 2 3 4 3
[object Object],1 2 3 2
Communicating between components ,[object Object]
Singletons
Handlers
Service binding
Remote procedure calls (i.e. AIDL) ,[object Object]
If you think your application is an exception: “Drag me to Hell - Optimizations for AIDL” Ronan Schwarz, Tic Mobile, 5.30pm. (Android Interface Definition Language)

Contenu connexe

Tendances

Tendances (20)

Android Training Report
Android Training ReportAndroid Training Report
Android Training Report
 
Android overview
Android overviewAndroid overview
Android overview
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Android Report
Android ReportAndroid Report
Android Report
 
Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android
 
Android seminar report
Android seminar reportAndroid seminar report
Android seminar report
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecture
 
Android Overview
Android OverviewAndroid Overview
Android Overview
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android summer training report
Android summer training reportAndroid summer training report
Android summer training report
 
ANDROID
ANDROIDANDROID
ANDROID
 
Android seminar-report-body.doc
Android seminar-report-body.docAndroid seminar-report-body.doc
Android seminar-report-body.doc
 
Seminar Report on Android OS
Seminar Report on Android OSSeminar Report on Android OS
Seminar Report on Android OS
 
Android OS
Android OSAndroid OS
Android OS
 
Introduction to Android - Mobile Portland
Introduction to Android - Mobile PortlandIntroduction to Android - Mobile Portland
Introduction to Android - Mobile Portland
 
Short notes of android
Short notes of androidShort notes of android
Short notes of android
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android OS PPT
Android OS PPTAndroid OS PPT
Android OS PPT
 
Android versions
Android versionsAndroid versions
Android versions
 

Similaire à Architecture your android_application

DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkbanq jdon
 
Android service, aidl - day 1
Android service, aidl - day 1Android service, aidl - day 1
Android service, aidl - day 1Utkarsh Mankad
 
Inter Process Communication (IPC) in Android
Inter Process Communication (IPC) in AndroidInter Process Communication (IPC) in Android
Inter Process Communication (IPC) in AndroidMalwinder Singh
 
4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message BrokersPROIDEA
 
Threads handlers and async task, widgets - day8
Threads   handlers and async task, widgets - day8Threads   handlers and async task, widgets - day8
Threads handlers and async task, widgets - day8Utkarsh Mankad
 
AIDL - Android Interface Definition Language
AIDL  - Android Interface Definition LanguageAIDL  - Android Interface Definition Language
AIDL - Android Interface Definition LanguageArvind Devaraj
 
Background Tasks with Worker Service
Background Tasks with Worker ServiceBackground Tasks with Worker Service
Background Tasks with Worker Servicessusere19c741
 
Android Training (Services)
Android Training (Services)Android Training (Services)
Android Training (Services)Khaled Anaqwa
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsAleksandar Ilić
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsPSTechSerbia
 
The Next Step in AS3 Framework Evolution
The Next Step in AS3 Framework EvolutionThe Next Step in AS3 Framework Evolution
The Next Step in AS3 Framework EvolutionFITC
 
Projet d'accès aux résultats des étudiant via client mobile
Projet d'accès aux résultats des étudiant via client mobile Projet d'accès aux résultats des étudiant via client mobile
Projet d'accès aux résultats des étudiant via client mobile Patrick Bashizi
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsMatteo Manchi
 

Similaire à Architecture your android_application (20)

DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFramework
 
Android101
Android101Android101
Android101
 
Android service, aidl - day 1
Android service, aidl - day 1Android service, aidl - day 1
Android service, aidl - day 1
 
Inter Process Communication (IPC) in Android
Inter Process Communication (IPC) in AndroidInter Process Communication (IPC) in Android
Inter Process Communication (IPC) in Android
 
4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers
 
Threads handlers and async task, widgets - day8
Threads   handlers and async task, widgets - day8Threads   handlers and async task, widgets - day8
Threads handlers and async task, widgets - day8
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
How to build typing indicator in a Chat app
How to build typing indicator in a Chat appHow to build typing indicator in a Chat app
How to build typing indicator in a Chat app
 
AIDL - Android Interface Definition Language
AIDL  - Android Interface Definition LanguageAIDL  - Android Interface Definition Language
AIDL - Android Interface Definition Language
 
Background Tasks with Worker Service
Background Tasks with Worker ServiceBackground Tasks with Worker Service
Background Tasks with Worker Service
 
Android Training (Services)
Android Training (Services)Android Training (Services)
Android Training (Services)
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App Components
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App Components
 
The Next Step in AS3 Framework Evolution
The Next Step in AS3 Framework EvolutionThe Next Step in AS3 Framework Evolution
The Next Step in AS3 Framework Evolution
 
Micronaut Launchpad
Micronaut LaunchpadMicronaut Launchpad
Micronaut Launchpad
 
Projet d'accès aux résultats des étudiant via client mobile
Projet d'accès aux résultats des étudiant via client mobile Projet d'accès aux résultats des étudiant via client mobile
Projet d'accès aux résultats des étudiant via client mobile
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
 

Dernier

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...apidays
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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, ...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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 DiscoveryTrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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 2024Victor Rentea
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
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
 
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 WoodJuan lago vázquez
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
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
 
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.pdfsudhanshuwaghmare1
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
"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 ...Zilliz
 

Dernier (20)

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...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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, ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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
 
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
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+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...
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
"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 ...
 

Architecture your android_application

  • 1. Architecture your Android Application Mark Brady
  • 2.
  • 5. Market App Framework Prototype [BETA]
  • 6.
  • 8. Background in web design, back-end development and Java ME
  • 9. Android Blog: http://blog.zedray.com/category/android/ “ Quick Dial / Call Log Widget”
  • 10.
  • 11.
  • 12. Lack of guidance on how to use them. Service Application Activity
  • 13.
  • 14.
  • 15.
  • 16.
  • 18. Finishing onStop() and onDestroy() may not be called if a process is killed (i.e. due to low memory)
  • 19.
  • 20. Do long running work in AsyncTask Separate non-UI thread will avoid ANR error.
  • 21.
  • 22. Code from multiple activities can be running in the background. No good definition for when an application has finished .
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 33.
  • 34. If you think your application is an exception: “Drag me to Hell - Optimizations for AIDL” Ronan Schwarz, Tic Mobile, 5.30pm. (Android Interface Definition Language)
  • 35. Java Singletons Flip side of running in on process/JVM is that objects in other components can be called as singletons: public class SingletonObject { private static SingletonObject ref; private SingletonObject() { // Do nothing. } public static SingletonObject getSingletonObject() { if (ref == null) { ref = new SingletonObject(); } return ref; } } Calling your singleton SingletonObject obj = SingletonObject.getSingletonObject();
  • 36.
  • 37.
  • 38. Calling Serivce.onBind() will create a Service that will remain running for as long as the ServiceConnection is established, or until a corresponding Service.onUnbind() is called. Service
  • 39.
  • 40. Service binding #3 Bind to this Service: mContext.bindService(new Intent(mContext, MyService.class), mServiceConnection, Context.BIND_AUTO_CREATE); Unbind from this Service: mContext.unbindService(mServiceConnection); Monitor Service Connection: private final ServiceConnection mServiceConnection = new ServiceConnection() { public void onServiceConnected(final ComponentName className, final IBinder service) { mHandler = ((MyService.MyBinder) service).getHandler(); } public void onServiceDisconnected(final ComponentName className) { mHandler = null; } }; Service
  • 41.
  • 43. Market App Framework Prototype [BETA]
  • 47.
  • 48. State Handled in a single place, so implement database synchronization here.
  • 49. Worker Thread Call stopSelf() as soon as all user goals are complete.
  • 50. Source Code – BaseActivity #1 public class MyActivity extends BaseActivity { @Override public final void onCreate(final Bundle savedInstanceState) { // Database I/O. getCache() .getSomeStateValue(); getDb() .setSomeStateValue("Foo", "Bar"); } @Override protected final void onResume() { // Update the UI on resume. updateUi(); super.onResume(); } ...
  • 51. Source Code – BaseActivity #2 ... public final void doSomeTask() { // Post something to Service queue. getServiceQueue().postToService (Type.DO_SOME_TASK, null); } @Override public final void post (final Type type, final Bundle bundle) { // Implement an incoming UI message, depending on type. switch (type) { case SHOW_SOME_UI: showSomeUi(); break; case UPDATE_UI: updateUi(); break; default: /** Let the BaseActivity handle other message types. */ super.post(type, bundle); break; } } }
  • 52. Source Code – WorkerThread #1 public class WorkerThread extends Thread { public final void run() { while ( mWorkQueue .size() > 0) { synchronized ( mWorkQueue ) { // Remove a task from the queue. Message message = mWorkQueue .remove(0); ... } // Do the task, depending on type. switch (type) { case DO_SOME_TASK: doSomeTask(bundle); break; } } // No work to do, so kill the service. mMyService .stopSelf(); } ...
  • 53. Source Code – WorkerThread #2 ... private void doSomeTask(final Bundle bundle) { mCache .setState("Loading"); mUiQueue . postToUi (Type.UPDATE_UI, null, true); // Do some setup work. ... mCache .setState("Running"); mUiQueue . postToUi (Type.UPDATE_UI, null, true); // Do some real work. ... mCache .setState("Finished"); mUiQueue.postToUi (Type.UPDATE_UI, null, true); if (someCondition) { // Show some custom UI (do not suppress). mUiQueue.postToUi (Type.SHOW_SOME_UI, null, false ); } } }
  • 54.
  • 56. Market App Framework Prototype [BETA]