SlideShare a Scribd company logo
1 of 26
Download to read offline
OSLL



Hello Android
         Vasily Romanikhin




                                     1
       vasily.romanikhin@gmail.com
                   
Table of content
●   About Android
●   Android Architecture
●   Application Fundamentals
       ●   Activity, Service,  ContentProvider, 
            BroadcastReceiver, Intent classes 
●   Application Resources
●   User Interface
●   Software for developing
●   Practice                      
                                                   2
What is Android?


                 ●   Android Inc.
                 ●   Open Handset Alliance 
                      (OHA)
                 ●   September 23, 2008
                 ●   October 21, 2008



              
                                          3
Android Architecture




              
                       4
The project structure
MyProject/                   ✔   src/
   src/
      MyActivity.java        ✔   res/
   res/
      drawable/
                                   ✔    drawable/
         icon.png                  ✔    layout/
      layout/
         main.xml                  ✔    values/
      values/
         strings.xml         ✔   gen/
      raw/
   libs/
                             ✔   AndroidManifest.xml
      ...
   assets/
      ...
   gen/
      R.java                                        5
   AndroidManifest.xml    
Application Fundamentals

●   Application Components:
       ●   Activities
       ●   Services
       ●   Broadcast receivers
       ●   Content providers
●   ~ Intent


                                
                                   6
Activity
http://developer.android.com/reference/android/app/Activity.html


                                                     ●        protected void 
                                                              onCreate(Bundle 
                                                              savedInstanceState);
                                                     ●        protected void onStart();
                                                     ●        protected void 
                                                              onRestart();
                                                     ●        protected void 
                                                              onResume();
                                                     ●        protected void 
                                                              onPause();
                                                     ●        protected void onStop();
                                                     ●        protected void 
                                                              onDestroy();

                                          
                                                                                     7
Service
http://developer.android.com/reference/android/app/Service.html




                                             ● startService(...)
                                             ● stopService(...)




                                             ● bindService(...)
                                             ● unbindService(...)




                                       
                                                                  8
Service Implementation
example




              
                         9
BroadcastReceiver
http://developer.android.com/reference/android/content/BroadcastReceiver.ht
ml



●   public void onReceive(Context context, 
      Intent intent) {/* Actions … */}
●   Before using BR you should register it 
      (dynamically – in code; or statically – 
      in AndroidManifest.xml)
●   The most often used with Service




                                       
                                                                        10
ContentProvider
http://developer.android.com/reference/android/content/ContentProvider.html


    The primary methods that need to be implemented are:
●   onCreate() which is called to initialize the provider
●   query(Uri, String[], String, String[], String) which returns data to the 
       caller
●   insert(Uri, ContentValues) which inserts new data into the content 
       provider
●   update(Uri, ContentValues, String, String[]) which updates existing data 
       in the content provider
●   delete(Uri, String, String[]) which deletes data from the content 
       provider




       ● Why is it need?
       ● See also ContentResolver, SQLiteOpenHanhler,

       SQLiteDatabase, SQLiteQueryBuilder, Cursor,
       ManagedCursor.
                                         
                                                                          11
Process Lifecycle

  Foreground process       Critical Priority



    Visible process
                           High Priority
   Service process


  Background process
                           Low Priority

    Empty process
                        
                                               12
AndroidManifest.xml
http://developer.android.com/guide/topics/manifest/manifest-intro.html

                                  <activity>
                                      <intent-filter>
                                          <action />
                                          <category />
<?xml version="1.0"                       <data />
encoding="utf-8"?>                    </intent-filter>
<manifest>                            <meta-data />
    <uses-permission />           </activity>
    <permission />                <activity-alias>
    <permission-tree />               <intent-filter>...</intent-filter>
    <permission-group />              <meta-data />
    <uses-sdk />                  </activity-alias>
    <uses-configuration />        <service>
    <uses-feature />                  <intent-filter>...</intent-filter>
    <supports-screens />              <meta-data/>
    <compatible-screens />        </service>
    <supports-gl-texture />       <receiver>
    <application>                     <intent-filter>...</intent-filter>
       ...                            <meta-data />
    </application>                </receiver>
</manifest>                       <provider>
                                      <grant-uri-permission />
                                      <meta-data />
                                  </provider>
                                       
                                                                           13
Application Resourses
                            res/
MyProject/                  ●   anim/
   src/
      MyActivity.java       ●   color/
   res/
      drawable/             ●   drawable/
         icon.png
      layout/               ●   layout/
         main.xml
      values/               ●   menu/
         strings.xml
      raw/                  ●   values/
   gen/
      R.java                ●   xml/
                            ●   raw         14
Application Resources




res/
    drawable/
        icon.png
        background.png
    drawable-hdpi/
        icon.png
        background.png




                          
                             15
Accessing Resources
/res/values/strings.xml




                           
                              16
User Interface
●   Runtime (programmically)
●   Xml layout file (ex: res/layout/main.xml)


●   ViewGroup
●   View




                             
                                                17
Example layout file




               
                      18
DDMS

DDMS (Dalvik Debug Monitoring Service) provides: 
● thread and heap information on the device


●   logcat
●   process
●   radio state information
●   incoming call and SMS spoofing 
●   location data spoofing
●   screen capture on the device and more.
                               
                                             19
Application Testing

                                      TestCase         JUnit
       Project

            Test Project           AndroidTestCase
     tested.project.dir=./..

                                         ServiceTestCase

                                   ProviderTestCase2
adb shell monkey ­p 
  ru.spb.osll.fileman      ApplicationTestCase
  ager ­v 500                   
                                                         20
Required software
●   JDK  >= 1.5 
●   Android SDK 
             (http://developer.android.com/sdk/index.html)

         ●   Adding Platforms and Other Components
●   Android NDK (http://developer.android.com/sdk/ndk/index.html)
●   Ant >= 1.7
   Eclipse (http://www.eclipse.org/downloads/)
   ADT (http://developer.android.com/sdk/eclipse­adt.html)
                                              
                                                                    21
Adding Platforms and Other
Components
●   android­sdk<...>/tools/android (Linux or Mac)
●   SDK Manager.exe (Windows)


                                         Result:
                                     ●   AVDs
                                     ●   USB Drivers
                                     ●   ...

                            
                                                       22
Troubles

●   Problems with jdk (don't use open­jdk)
●   ia32­libs (apt­get install ia32­libs)
●   Developing on a Device
        ●   USB Vendor IDs (for Linux or Mac)     Device ????
        ●   USB Driver (for Windows)




                                   
                                                                23
Practice
●   ExampleButton
●   ExampleButtonExt
●   ExStackActivity
●   ExService
●   ExBroadcastReceiver




                           
                              24
What is remained...

●   Storage data 
       ●   Internal, External Storage
       ●   DB
       ●   SharedPreferences


●   Designing for Performance 




                                 
                                        25
●   Questions... ???
     ●   Thanks!




               
                       26

More Related Content

Similar to Hello android

Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development PracticesRoy Clarkson
 
Android training in mumbai
Android training in mumbaiAndroid training in mumbai
Android training in mumbaiCIBIL
 
Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012Tomáš Kypta
 
Five android architecture
Five android architectureFive android architecture
Five android architectureTomislav Homan
 
Droidcon 2011: Working with the Android source, Ronan Schwarz, Openintents
Droidcon 2011: Working with the Android source, Ronan Schwarz, OpenintentsDroidcon 2011: Working with the Android source, Ronan Schwarz, Openintents
Droidcon 2011: Working with the Android source, Ronan Schwarz, OpenintentsDroidcon Berlin
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Dori waldman android _course
Dori waldman android _courseDori waldman android _course
Dori waldman android _courseDori Waldman
 
Dive into Play Framework
Dive into Play FrameworkDive into Play Framework
Dive into Play FrameworkMaher Gamal
 
How to React to JavaScript Insecurity
How to React to JavaScript InsecurityHow to React to JavaScript Insecurity
How to React to JavaScript InsecurityKsenia Peguero
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java PlatformSivakumar Thyagarajan
 
Grails 101
Grails 101Grails 101
Grails 101Lim Kin
 
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Loïc Knuchel
 
Android workshop material
Android workshop materialAndroid workshop material
Android workshop materialReza Yogaswara
 
Dori waldman android _course_2
Dori waldman android _course_2Dori waldman android _course_2
Dori waldman android _course_2Dori Waldman
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump StartConFoo
 
Android App Development - 01 Introduction
Android App Development - 01 IntroductionAndroid App Development - 01 Introduction
Android App Development - 01 IntroductionDiego Grancini
 

Similar to Hello android (20)

Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
Ruby conf2012
Ruby conf2012Ruby conf2012
Ruby conf2012
 
Android training in mumbai
Android training in mumbaiAndroid training in mumbai
Android training in mumbai
 
Android101
Android101Android101
Android101
 
Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012
 
Five android architecture
Five android architectureFive android architecture
Five android architecture
 
React django
React djangoReact django
React django
 
Android - Anatomy of android elements & layouts
Android - Anatomy of android elements & layoutsAndroid - Anatomy of android elements & layouts
Android - Anatomy of android elements & layouts
 
Droidcon 2011: Working with the Android source, Ronan Schwarz, Openintents
Droidcon 2011: Working with the Android source, Ronan Schwarz, OpenintentsDroidcon 2011: Working with the Android source, Ronan Schwarz, Openintents
Droidcon 2011: Working with the Android source, Ronan Schwarz, Openintents
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Dori waldman android _course
Dori waldman android _courseDori waldman android _course
Dori waldman android _course
 
Dive into Play Framework
Dive into Play FrameworkDive into Play Framework
Dive into Play Framework
 
How to React to JavaScript Insecurity
How to React to JavaScript InsecurityHow to React to JavaScript Insecurity
How to React to JavaScript Insecurity
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java Platform
 
Grails 101
Grails 101Grails 101
Grails 101
 
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
 
Android workshop material
Android workshop materialAndroid workshop material
Android workshop material
 
Dori waldman android _course_2
Dori waldman android _course_2Dori waldman android _course_2
Dori waldman android _course_2
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump Start
 
Android App Development - 01 Introduction
Android App Development - 01 IntroductionAndroid App Development - 01 Introduction
Android App Development - 01 Introduction
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
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
 
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
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
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
 
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...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Hello android

  • 1. OSLL Hello Android Vasily Romanikhin 1 vasily.romanikhin@gmail.com  
  • 2. Table of content ● About Android ● Android Architecture ● Application Fundamentals ● Activity, Service,  ContentProvider,  BroadcastReceiver, Intent classes  ● Application Resources ● User Interface ● Software for developing ● Practice   2
  • 3. What is Android? ● Android Inc. ● Open Handset Alliance  (OHA) ● September 23, 2008 ● October 21, 2008   3
  • 5. The project structure MyProject/ ✔ src/ src/ MyActivity.java ✔ res/ res/ drawable/ ✔ drawable/ icon.png ✔ layout/ layout/ main.xml ✔ values/ values/ strings.xml ✔ gen/ raw/ libs/ ✔ AndroidManifest.xml ... assets/ ... gen/ R.java 5 AndroidManifest.xml  
  • 6. Application Fundamentals ● Application Components: ● Activities ● Services ● Broadcast receivers ● Content providers ● ~ Intent   6
  • 7. Activity http://developer.android.com/reference/android/app/Activity.html ●      protected void  onCreate(Bundle  savedInstanceState); ●      protected void onStart(); ●      protected void  onRestart(); ●      protected void  onResume(); ●      protected void  onPause(); ●      protected void onStop(); ●      protected void  onDestroy();   7
  • 8. Service http://developer.android.com/reference/android/app/Service.html ● startService(...) ● stopService(...) ● bindService(...) ● unbindService(...)   8
  • 10. BroadcastReceiver http://developer.android.com/reference/android/content/BroadcastReceiver.ht ml ● public void onReceive(Context context,  Intent intent) {/* Actions … */} ● Before using BR you should register it  (dynamically – in code; or statically –  in AndroidManifest.xml) ● The most often used with Service   10
  • 11. ContentProvider http://developer.android.com/reference/android/content/ContentProvider.html The primary methods that need to be implemented are: ● onCreate() which is called to initialize the provider ● query(Uri, String[], String, String[], String) which returns data to the  caller ● insert(Uri, ContentValues) which inserts new data into the content  provider ● update(Uri, ContentValues, String, String[]) which updates existing data  in the content provider ● delete(Uri, String, String[]) which deletes data from the content  provider ● Why is it need? ● See also ContentResolver, SQLiteOpenHanhler, SQLiteDatabase, SQLiteQueryBuilder, Cursor, ManagedCursor.   11
  • 12. Process Lifecycle Foreground process Critical Priority Visible process High Priority Service process Background process Low Priority Empty process   12
  • 13. AndroidManifest.xml http://developer.android.com/guide/topics/manifest/manifest-intro.html <activity> <intent-filter> <action /> <category /> <?xml version="1.0" <data /> encoding="utf-8"?> </intent-filter> <manifest> <meta-data /> <uses-permission /> </activity> <permission /> <activity-alias> <permission-tree /> <intent-filter>...</intent-filter> <permission-group /> <meta-data /> <uses-sdk /> </activity-alias> <uses-configuration /> <service> <uses-feature /> <intent-filter>...</intent-filter> <supports-screens /> <meta-data/> <compatible-screens /> </service> <supports-gl-texture /> <receiver> <application> <intent-filter>...</intent-filter> ... <meta-data /> </application> </receiver> </manifest> <provider> <grant-uri-permission /> <meta-data /> </provider>   13
  • 14. Application Resourses res/ MyProject/ ● anim/ src/ MyActivity.java ● color/ res/ drawable/ ● drawable/ icon.png layout/ ● layout/ main.xml values/ ● menu/ strings.xml raw/ ● values/ gen/ R.java ● xml/   ● raw 14
  • 15. Application Resources res/ drawable/ icon.png background.png drawable-hdpi/ icon.png background.png   15
  • 17. User Interface ● Runtime (programmically) ● Xml layout file (ex: res/layout/main.xml) ● ViewGroup ● View   17
  • 19. DDMS DDMS (Dalvik Debug Monitoring Service) provides:  ● thread and heap information on the device ● logcat ● process ● radio state information ● incoming call and SMS spoofing  ● location data spoofing ● screen capture on the device and more.   19
  • 20. Application Testing TestCase JUnit Project Test Project AndroidTestCase tested.project.dir=./.. ServiceTestCase ProviderTestCase2 adb shell monkey ­p  ru.spb.osll.fileman ApplicationTestCase ager ­v 500   20
  • 21. Required software ● JDK  >= 1.5  ● Android SDK  (http://developer.android.com/sdk/index.html) ● Adding Platforms and Other Components ● Android NDK (http://developer.android.com/sdk/ndk/index.html) ● Ant >= 1.7  Eclipse (http://www.eclipse.org/downloads/)  ADT (http://developer.android.com/sdk/eclipse­adt.html)   21
  • 22. Adding Platforms and Other Components ● android­sdk<...>/tools/android (Linux or Mac) ● SDK Manager.exe (Windows) Result: ● AVDs ● USB Drivers ● ...   22
  • 23. Troubles ● Problems with jdk (don't use open­jdk) ● ia32­libs (apt­get install ia32­libs) ● Developing on a Device ● USB Vendor IDs (for Linux or Mac)     Device ???? ● USB Driver (for Windows)   23
  • 24. Practice ● ExampleButton ● ExampleButtonExt ● ExStackActivity ● ExService ● ExBroadcastReceiver   24
  • 25. What is remained... ● Storage data  ● Internal, External Storage ● DB ● SharedPreferences ● Designing for Performance    25
  • 26. Questions... ??? ● Thanks!   26