SlideShare ist ein Scribd-Unternehmen logo
1 von 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)

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

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
 
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
 
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
 
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
 
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
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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
 
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
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 

Kürzlich hochgeladen (20)

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
 
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...
 
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
 
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
 
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...
 
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...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
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...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
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?
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 

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]