SlideShare a Scribd company logo
1 of 63
Download to read offline
Android
                                     Jump Start
                                             ConFoo
                                         Mar 11, 2011




    Mike Willbanks
       Blog: http://blog.digitalstruct.com
    Twitter: mwillbanks
         IRC: lubs on freenode




                                                
Outline

      ●   Overview                       ●   Building an App
          ●   What is Android                ●   A First App
          ●   Application Components         ●   And many other things
          ●   Application Manifest
          ●   Resources and UI
          ●   The SDK




                                      
What is Android?
      “Android is a software stack for mobile devices that includes an 
           operating system, middleware and key applications.”




                                     
Application
    Components




          
Application Components
      ●   Activities
          ●   Representative of a single screen UI*.
      ●   Broadcast Receivers
          ●   A component that responds to system­wide broadcast 
              announcements.
      ●   Services
          ●   A component running in the background handling long­
              running operations and/or performing work for remote 
              processes.
      ●   Content Providers
          ●   A component that manages a shared set of application 
              data.                  
Activities
      ●   Provides a screen where users can interact to do 
          “something”
      ●   Generally correspond to a single screen in a UI
          ●   Exceptions: Faceless or Floating Windows
      ●   Think of it as a Controller in MVC
          ●   However, it does include much of the View.




                                     
Activities: Tasks and Back Stack




                            
Activities: The Lifecycle




                             
Intents
      ●   Events / Messages
      ●   The Application Glue
          ●   Intents can be thought of as a hyperlink in a web 
              application.
          ●   Launching new activities requires an Intent.
      ●   Intents also describe what is to be done.
          ●   Such as playing a video, making a call, etc.
          ●   A good list can be found at http://openintents.org/
      ●   IntentFilters determine which Activities can be 
          serviced via AndroidManifest.xml
                                       
Broadcast Receivers
      ●   Components that respond to Broadcast Intents
          ●   Examples include C2dm, Low Battery, Screen 
              Turned Off/On, Change in Timezone, Wifi Turned 
              Off/On, etc.
      ●   Essentially an external event or an alarm
      ●   You can also create and initiate your own Broadcast 
          Intents
      ●   Intended to do a minimal amount of work
          ●   Longer running processes should either launch or 
              utilize a Service component.

                                     
Services
      ●   Components that run in the background
          ●   No UI (faceless)
          ●   Poll requests, Downloads, MP3 Playback
      ●   Bound and Unbound
          ●   Bound services are managed by an Activity
          ●   Unbound services are expected to manage 
              themselves.
      ●   Runs in the main thread, unless otherwise specified
          ●   In the event of CPU intensive or blocking operations 
              create a new thread.
                                      
Services: The Lifecycle




                           
Content Providers
      ●   The only way to share data between applications.
          ●   You must ask for permission to these assets.
      ●   Access to several types of data
          ●   Alarm Clock, Browser, Contacts, Media (Music, 
              Video, Images), System Level Settings, User 
              Dictionary
      ●   Each application can utilize exiting and define their 
          own.
          ●   Generally utilized through SQLite


                                      
Application
     Manifest




          
Application Manifest
      ●   Every application MUST have an 
          ApplicationManifest.xml file.
      ●   It tells Android about your application
          ●   The package name
          ●   Application components (Activities / Services / 
              Broadcast Receivers / Content Providers)
          ●   Permissions required / requested
          ●   Minimum and Target SDK versions
          ●   Linked Libraries


                                      
Application Manifest: An Example




                           
Application Manifest: Legal Elements
      ●   action                 ●   permission­group
      ●   activity               ●   permission­tree
      ●   activity­alias         ●   provider
      ●   application            ●   receiver
      ●   category               ●   service
      ●   data                   ●   supports­screens
      ●   grant­uri­permission   ●   uses­configuration
      ●   instrumentation        ●   uses­feature
      ●   intent­filter          ●   uses­library
      ●   manifest               ●   uses­permission
      ●   meta­data              ●   uses­sdk
                                      
      ●   permission
Resources
       and
        UI




         
Resources
     ●   Resources are contained in the /res folder
         ●   Resource Types:
             –   anim: Tween Animations
             –   color: State List of Colors
             –   drawable: Bitmaps aka Images
             –   layout: UI on Screen
             –   menu: Options Menu / Context Menu / Sub Menu
             –   raw: Files you'd open with Input Stream
             –   values: Arrays, Colors, Dimensions, Strings, 
                 Styles
             –   xml: configuration / search­able configuration
                                         
Resources: The Qualifiers
      ●   Basic resources are stored at the root folders
      ●   Resources have qualifiers that allow you to customize 
          the experience which separate the folders by a dash.
          ●   Localization (Country / Region / Language)
          ●   Screen (Size / Touch / Orientation / Ratio / Density)
          ●   Navigation (State / Method)
          ●   Dock or Night mode
          ●   API Version
      ●   Generally, you'll keep it simple but have adjustments 
          for: Orientation, Size and Language.

                                       
Resources: An example layout
                   ●   Items in red are generic 
                       resources.
                   ●   Blue items are qualitative and if 
                       not matched fall back to generic.




                            
Resources: Strings
      ●   The string XML file defines a name (key) for your text
          ●   Stylization is possible with some HTML elements
              –   Bold, Italic, Underline, Monospace, Superscript, 
                  Subscript and Strikethrough (b, i, u, tt, big, small, 
                  sup, sub, strike)




                                         
Resources: Layouts
      ●   The Layout is the screen view of your application.
      ●   There are several types of layouts:
          ●   FrameLayout: The simplest layout
          ●   LinearLayout: Aligns children in a single direction
          ●   TableLayout: Most frustrating layout
          ●   RelativeLayout: The most common layout
      ●   There are several other specialty views available to 
          wrap the layouts
          ●   ScrollView, TabHost, ViewFlipper, GridView, etc.


                                       
Resources: Layouts: Elements
      ●   Contained in each layout is generally XML defining 
          each type of element of widget you want to use.
          ●   From a high level view these include
              –   Button, Checkbox, DatePicker, EditText, 
                  ImageView, ListView, TextView
          ●   You can find all of these in the android.widget 
              package.




                                       
Resources: Layouts: Example




                         
SDK




      
SDK: Overview
     ●   The SDK contains everything you need to build an 
         android application, however, to aide you they also 
         made an eclipse plugin ADT.
     ●   After installing the SDK, I recommend you install the 
         eclipse plugin – it will save you time later.
     ●   Launch the SDK and install all available packages
         ●   This is useful for testing the emulator with different 
             versions as well as ensuring you have the Google 
             API's as well.
     ●   Windows users: You need to ensure you download the 
         USB driver if you plan to use your phone for testing.
                                       
SDK: Navigating the SDK




                           
Building
      An
     App




        
Our First Activity: Building the Project
      ●   Before we begin anything we need to start an android 
          project.  I prefer ant, so creating this project is quick:




                                      
Our First Activity: Installing the Project
      ●   We now have an application, that is installable.
          ●   If our emulator is running – we can just run:
              –   ant install
                   ●   Note: If you are using an actual device and 
                       you are on linux, you must start the “adb” 
                       server as root: sudo adb start­server




                                         
Our First Activity: Changing the Theme and Icon
      ●   I am not a fan of the black background and how the 
          interface looks, luckily android supports themes!
          ●   Canned Themes can be found in the sdk folder: 
              platforms/android­ver/data/res/values/themes.xml
              –   We'll use Theme.Light
          ●   Themes can be applied to a whole application, an 
              activity or an element.
              –   We will change it on the whole application, which 
                  simply requires a change to the 
                  AndroidManifest.xml file.
          ●   Want to make your own theme?
   
              –   Extend one of the ones already made.
                                       
Our First Activity: Changing the Theme




                           
Our First Activity: Adding a Logo
      ●   Let's take a confoo logo and put it at the top of the 
          activity.
          ●   Since there is no generic “drawable” resource we'll 
              make one and store it there.
      ●   We can then reference the image in our xml as 
          @drawable/confoo
      ●   The activity's layout is current set as “main.xml” in 
          res/layout




                                      
Our First Activity: Adding a Logo




                             
Our First Activity: Updating the Text
      ●   So the canned text is currently hard coded and not 
          using the res/values/strings.xml file.  Let's change that 
          and update it.  While we are there we will update the 
          application name.
          ●   Referencing strings in our application is as easy as 
              @string/name we'll make this change in our layout 
              after we add the keys.




                                      
Our First Activity: Updating the Text




                             
Adding
      A
    Menu




       
Adding a Menu: Using res/menu
      ●   To build a menu, we simply need to add an xml file to 
          res/menu and incorporate it into our code.
          ●   Using the stock icons you can find under the 
              android­sdk­dir/platforms/android­ver/res/drawable­
              *
          ●   We also need to add in code to our activity to make 
              this menu load.
          ●   We will add in a menu item for the Schedule, 
              Joind.in and Twitter.



                                      
Adding a Menu: res/menu/main.xml




                         
Adding a Menu: The Activity




                           
Adding a Menu: Incorporate WebKit
      ●   To make this menu functional let's introduce a browser.
      ●   Here we can use Intents to launch a specific URL in the 
          browser.




                                         
Adding
       A
    TabHost




        
Adding a TabHost
      ●   A TabHost allows us to have several open actions at 
          once and keep the state of them during that time.
      ●   It also lets us navigate the app slightly easier.
          ●   Let's put the same things that we have in the menu 
              bar there for now.
              –   But, we need to modify this as well.  Let's use 
                  webkit in our own internal browser.
      ●   This also means we now need to create a tabhost 
          activity and change the manifest to go to the tab host 
          activity first.


                                        
Making a Browser Activity




                             
Making a Browser Activity




                             
The Tab Host




                
The Tab Host




                
Changes to the Manifest




                           
Publishing




         
Signing your Application
      ●   First step in publishing is generating a private key:
             keytool -genkey -v -keystore my-release-key.keystore
             -alias alias_name -keyalg RSA -keysize 2048 -validity
             10000
      ●   Secondly, if you are using ant and want to automate 
          release builds modify local.properties with your 
          passphrase:




      ●   Now, let it rip: ant release

   
      ●   Now it is off to market.android.com/publish
                                      
Advanced
      Stuff




        
Gotchas
     ●   When using an AsyncTask
         ●   Always ensure you check you're still in the view you 
             need.  Crashing issues apply.
     ●   When using a Progress Dialog
         ●   Ensure it still exists and that it is showing – never 
             assume it is still existing.
     ●   Some code to give you a better idea:




                                       
Gotchas: AsyncTask + Progress Dialog




                          
Gotchas
     ●   If your configuration changes (Orientation Change), 
         ensure that you stated it in your AndroidManifest as 
         well as your Activity to handle things such as Progress 
         Dialogs 
         ●   Android by default will re­create the view and 
             activity.




                                     
Gotchas




           
Gotchas
     ●   If your server utilizes tokens or some form of sessions
         ●   When you close the application, it will remain in a 
             background process until android needs memory.  
             Ensure that you handle this – users become 
             unhappy otherwise :)
     ●   Before you use the internet make sure that it does 
         exist :)




                                     
C2dm
     ●   Cloud 2 Device Messaging works basically the same 
         as Apple Push Notification Service, except far more 
         flexible.
     ●   Your application registers a broadcast receiver and 
         fires off an intent to register the device.  You receive 
         back an ID that you subsequently store on your own 
         server.
     ●   We're talking about how to handle this in your app – 
         the web server part is far more complex:
         ●   See: 
             http://blog.digitalstruct.com/2010/11/21/android­
             c2dm­with­php­and­zend­framework/
                                      
C2dm
     ●   What needs to happen
         ●   Ask for permissions in the manifest, publish a 
             broadcast receiver and ask google for the 
             registration ID
         ●   Before that although, you do need to sign up: 
             http://code.google.com/android/c2dm/index.html




                                     
C2dm: The Manifest




                      
C2dm: The Receiver




                      
More Examples....




                     
Questions?

    Mike Willbanks
         Blog : http://blog.digitalstruct.com
     Twitter : mwillbanks
          IRC : lubs on freenode




                                    

More Related Content

What's hot

Rich Text Editing and Beyond
Rich Text Editing and BeyondRich Text Editing and Beyond
Rich Text Editing and BeyondCommonsWare
 
Introduction to Android Development Part 1
Introduction to Android Development Part 1Introduction to Android Development Part 1
Introduction to Android Development Part 1Kainda Kiniel Daka
 
2013 04-02-server-side-backbone
2013 04-02-server-side-backbone2013 04-02-server-side-backbone
2013 04-02-server-side-backboneSC5.io
 
Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Opersys inc.
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android WorkshopOpersys inc.
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android WorkshopOpersys inc.
 
How to Survive Multi-Device User Interface Design with UIML
How to Survive Multi-Device User Interface Design with UIMLHow to Survive Multi-Device User Interface Design with UIML
How to Survive Multi-Device User Interface Design with UIMLJo Vermeulen
 
Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013Opersys inc.
 

What's hot (8)

Rich Text Editing and Beyond
Rich Text Editing and BeyondRich Text Editing and Beyond
Rich Text Editing and Beyond
 
Introduction to Android Development Part 1
Introduction to Android Development Part 1Introduction to Android Development Part 1
Introduction to Android Development Part 1
 
2013 04-02-server-side-backbone
2013 04-02-server-side-backbone2013 04-02-server-side-backbone
2013 04-02-server-side-backbone
 
Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
 
How to Survive Multi-Device User Interface Design with UIML
How to Survive Multi-Device User Interface Design with UIMLHow to Survive Multi-Device User Interface Design with UIML
How to Survive Multi-Device User Interface Design with UIML
 
Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013
 

Viewers also liked

Paraccel/Database Architechs Press Release
Paraccel/Database Architechs Press ReleaseParaccel/Database Architechs Press Release
Paraccel/Database Architechs Press ReleaseDatabase Architechs
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confooCombell NV
 
Dealing with Continuous Data Processing, ConFoo 2012
Dealing with Continuous Data Processing, ConFoo 2012Dealing with Continuous Data Processing, ConFoo 2012
Dealing with Continuous Data Processing, ConFoo 2012Michael Peacock
 
Symfony CMF: un nuovo paradigma per la gestione dei contenuti
Symfony CMF: un nuovo paradigma per la gestione dei contenutiSymfony CMF: un nuovo paradigma per la gestione dei contenuti
Symfony CMF: un nuovo paradigma per la gestione dei contenutiMichele Orselli
 
Trouvez la faille! - Confoo 2012
Trouvez la faille! - Confoo 2012Trouvez la faille! - Confoo 2012
Trouvez la faille! - Confoo 2012Antonio Fontes
 
Time Table Management System
Time Table Management SystemTime Table Management System
Time Table Management SystemMuhammad Zeeshan
 

Viewers also liked (7)

Paraccel/Database Architechs Press Release
Paraccel/Database Architechs Press ReleaseParaccel/Database Architechs Press Release
Paraccel/Database Architechs Press Release
 
Running on Amazon EC2
Running on Amazon EC2Running on Amazon EC2
Running on Amazon EC2
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
 
Dealing with Continuous Data Processing, ConFoo 2012
Dealing with Continuous Data Processing, ConFoo 2012Dealing with Continuous Data Processing, ConFoo 2012
Dealing with Continuous Data Processing, ConFoo 2012
 
Symfony CMF: un nuovo paradigma per la gestione dei contenuti
Symfony CMF: un nuovo paradigma per la gestione dei contenutiSymfony CMF: un nuovo paradigma per la gestione dei contenuti
Symfony CMF: un nuovo paradigma per la gestione dei contenuti
 
Trouvez la faille! - Confoo 2012
Trouvez la faille! - Confoo 2012Trouvez la faille! - Confoo 2012
Trouvez la faille! - Confoo 2012
 
Time Table Management System
Time Table Management SystemTime Table Management System
Time Table Management System
 

Similar to Android Jump Start

Android development - the basics, FI MUNI, 2012
Android development - the basics, FI MUNI, 2012Android development - the basics, FI MUNI, 2012
Android development - the basics, FI MUNI, 2012Tomáš Kypta
 
Android workshop material
Android workshop materialAndroid workshop material
Android workshop materialReza Yogaswara
 
android development training in mumbai
android development training in mumbaiandroid development training in mumbai
android development training in mumbaifaizrashid1995
 
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a NutshellAleix Solé
 
Android Workshop Part 1
Android Workshop Part 1Android Workshop Part 1
Android Workshop Part 1NAILBITER
 
Android Development...The 20,000-Foot View
Android Development...The 20,000-Foot ViewAndroid Development...The 20,000-Foot View
Android Development...The 20,000-Foot ViewCommonsWare
 
Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Opersys inc.
 
Android development orientation for starters v2
Android development orientation for starters v2Android development orientation for starters v2
Android development orientation for starters v2Joemarie Amparo
 
Android Development Tutorial
Android Development TutorialAndroid Development Tutorial
Android Development TutorialGermán Bringas
 
Android application development
Android application developmentAndroid application development
Android application developmentLinh Vi Tường
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions newJoe Jacob
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app developmentAbhishekKumar4779
 
Begining Android Development
Begining Android DevelopmentBegining Android Development
Begining Android DevelopmentHayi Nukman
 
Leveraging Android's Linux Heritage
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux HeritageOpersys inc.
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersBoom Shukla
 
Mobile Application Development powerpoint
Mobile Application Development powerpointMobile Application Development powerpoint
Mobile Application Development powerpointJohnLagman3
 
Android architecture
Android architectureAndroid architecture
Android architectureDeepa Rahul
 
Introduction to Android Development.pptx
Introduction to Android Development.pptxIntroduction to Android Development.pptx
Introduction to Android Development.pptxasmeerana605
 
5 beginner android application development foundation
5 beginner android application development foundation5 beginner android application development foundation
5 beginner android application development foundationCbitss Technologies
 

Similar to Android Jump Start (20)

Android development - the basics, FI MUNI, 2012
Android development - the basics, FI MUNI, 2012Android development - the basics, FI MUNI, 2012
Android development - the basics, FI MUNI, 2012
 
Android workshop material
Android workshop materialAndroid workshop material
Android workshop material
 
android development training in mumbai
android development training in mumbaiandroid development training in mumbai
android development training in mumbai
 
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a Nutshell
 
Android Workshop Part 1
Android Workshop Part 1Android Workshop Part 1
Android Workshop Part 1
 
Android Development...The 20,000-Foot View
Android Development...The 20,000-Foot ViewAndroid Development...The 20,000-Foot View
Android Development...The 20,000-Foot View
 
Intro to android (gdays)
Intro to android (gdays)Intro to android (gdays)
Intro to android (gdays)
 
Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3
 
Android development orientation for starters v2
Android development orientation for starters v2Android development orientation for starters v2
Android development orientation for starters v2
 
Android Development Tutorial
Android Development TutorialAndroid Development Tutorial
Android Development Tutorial
 
Android application development
Android application developmentAndroid application development
Android application development
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
 
Begining Android Development
Begining Android DevelopmentBegining Android Development
Begining Android Development
 
Leveraging Android's Linux Heritage
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux Heritage
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
 
Mobile Application Development powerpoint
Mobile Application Development powerpointMobile Application Development powerpoint
Mobile Application Development powerpoint
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Introduction to Android Development.pptx
Introduction to Android Development.pptxIntroduction to Android Development.pptx
Introduction to Android Development.pptx
 
5 beginner android application development foundation
5 beginner android application development foundation5 beginner android application development foundation
5 beginner android application development foundation
 

More from ConFoo

Debugging applications with network security tools
Debugging applications with network security toolsDebugging applications with network security tools
Debugging applications with network security toolsConFoo
 
The business behind open source
The business behind open sourceThe business behind open source
The business behind open sourceConFoo
 
Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?ConFoo
 
OWASP Enterprise Security API
OWASP Enterprise Security APIOWASP Enterprise Security API
OWASP Enterprise Security APIConFoo
 
Opensource Authentication and Authorization
Opensource Authentication and AuthorizationOpensource Authentication and Authorization
Opensource Authentication and AuthorizationConFoo
 
Introduction à la sécurité des WebServices
Introduction à la sécurité des WebServicesIntroduction à la sécurité des WebServices
Introduction à la sécurité des WebServicesConFoo
 
Le bon, la brute et le truand dans les nuages
Le bon, la brute et le truand dans les nuagesLe bon, la brute et le truand dans les nuages
Le bon, la brute et le truand dans les nuagesConFoo
 
The Solar Framework for PHP
The Solar Framework for PHPThe Solar Framework for PHP
The Solar Framework for PHPConFoo
 
Décrire un projet PHP dans des rapports
Décrire un projet PHP dans des rapportsDécrire un projet PHP dans des rapports
Décrire un projet PHP dans des rapportsConFoo
 
Server Administration in Python with Fabric, Cuisine and Watchdog
Server Administration in Python with Fabric, Cuisine and WatchdogServer Administration in Python with Fabric, Cuisine and Watchdog
Server Administration in Python with Fabric, Cuisine and WatchdogConFoo
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+ConFoo
 
Think Mobile First, Then Enhance
Think Mobile First, Then EnhanceThink Mobile First, Then Enhance
Think Mobile First, Then EnhanceConFoo
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in RubyConFoo
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101ConFoo
 
As-t-on encore besoin d'un framework web ?
As-t-on encore besoin d'un framework web ?As-t-on encore besoin d'un framework web ?
As-t-on encore besoin d'un framework web ?ConFoo
 
Pragmatic Guide to Git
Pragmatic Guide to GitPragmatic Guide to Git
Pragmatic Guide to GitConFoo
 
Building servers with Node.js
Building servers with Node.jsBuilding servers with Node.js
Building servers with Node.jsConFoo
 
An Overview of Flash Storage for Databases
An Overview of Flash Storage for DatabasesAn Overview of Flash Storage for Databases
An Overview of Flash Storage for DatabasesConFoo
 
Develop mobile applications with Flex
Develop mobile applications with FlexDevelop mobile applications with Flex
Develop mobile applications with FlexConFoo
 
WordPress pour le développement d'aplications web
WordPress pour le développement d'aplications webWordPress pour le développement d'aplications web
WordPress pour le développement d'aplications webConFoo
 

More from ConFoo (20)

Debugging applications with network security tools
Debugging applications with network security toolsDebugging applications with network security tools
Debugging applications with network security tools
 
The business behind open source
The business behind open sourceThe business behind open source
The business behind open source
 
Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?
 
OWASP Enterprise Security API
OWASP Enterprise Security APIOWASP Enterprise Security API
OWASP Enterprise Security API
 
Opensource Authentication and Authorization
Opensource Authentication and AuthorizationOpensource Authentication and Authorization
Opensource Authentication and Authorization
 
Introduction à la sécurité des WebServices
Introduction à la sécurité des WebServicesIntroduction à la sécurité des WebServices
Introduction à la sécurité des WebServices
 
Le bon, la brute et le truand dans les nuages
Le bon, la brute et le truand dans les nuagesLe bon, la brute et le truand dans les nuages
Le bon, la brute et le truand dans les nuages
 
The Solar Framework for PHP
The Solar Framework for PHPThe Solar Framework for PHP
The Solar Framework for PHP
 
Décrire un projet PHP dans des rapports
Décrire un projet PHP dans des rapportsDécrire un projet PHP dans des rapports
Décrire un projet PHP dans des rapports
 
Server Administration in Python with Fabric, Cuisine and Watchdog
Server Administration in Python with Fabric, Cuisine and WatchdogServer Administration in Python with Fabric, Cuisine and Watchdog
Server Administration in Python with Fabric, Cuisine and Watchdog
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
Think Mobile First, Then Enhance
Think Mobile First, Then EnhanceThink Mobile First, Then Enhance
Think Mobile First, Then Enhance
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in Ruby
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 
As-t-on encore besoin d'un framework web ?
As-t-on encore besoin d'un framework web ?As-t-on encore besoin d'un framework web ?
As-t-on encore besoin d'un framework web ?
 
Pragmatic Guide to Git
Pragmatic Guide to GitPragmatic Guide to Git
Pragmatic Guide to Git
 
Building servers with Node.js
Building servers with Node.jsBuilding servers with Node.js
Building servers with Node.js
 
An Overview of Flash Storage for Databases
An Overview of Flash Storage for DatabasesAn Overview of Flash Storage for Databases
An Overview of Flash Storage for Databases
 
Develop mobile applications with Flex
Develop mobile applications with FlexDevelop mobile applications with Flex
Develop mobile applications with Flex
 
WordPress pour le développement d'aplications web
WordPress pour le développement d'aplications webWordPress pour le développement d'aplications web
WordPress pour le développement d'aplications web
 

Recently uploaded

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Recently uploaded (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Android Jump Start

  • 1. Android Jump Start ConFoo Mar 11, 2011 Mike Willbanks    Blog: http://blog.digitalstruct.com Twitter: mwillbanks      IRC: lubs on freenode    
  • 2. Outline ● Overview ● Building an App ● What is Android ● A First App ● Application Components ● And many other things ● Application Manifest ● Resources and UI ● The SDK    
  • 3. What is Android? “Android is a software stack for mobile devices that includes an  operating system, middleware and key applications.”    
  • 4. Application Components    
  • 5. Application Components ● Activities ● Representative of a single screen UI*. ● Broadcast Receivers ● A component that responds to system­wide broadcast  announcements. ● Services ● A component running in the background handling long­ running operations and/or performing work for remote  processes. ● Content Providers ● A component that manages a shared set of application    data.  
  • 6. Activities ● Provides a screen where users can interact to do  “something” ● Generally correspond to a single screen in a UI ● Exceptions: Faceless or Floating Windows ● Think of it as a Controller in MVC ● However, it does include much of the View.    
  • 9. Intents ● Events / Messages ● The Application Glue ● Intents can be thought of as a hyperlink in a web  application. ● Launching new activities requires an Intent. ● Intents also describe what is to be done. ● Such as playing a video, making a call, etc. ● A good list can be found at http://openintents.org/ ● IntentFilters determine which Activities can be  serviced via AndroidManifest.xml    
  • 10. Broadcast Receivers ● Components that respond to Broadcast Intents ● Examples include C2dm, Low Battery, Screen  Turned Off/On, Change in Timezone, Wifi Turned  Off/On, etc. ● Essentially an external event or an alarm ● You can also create and initiate your own Broadcast  Intents ● Intended to do a minimal amount of work ● Longer running processes should either launch or  utilize a Service component.    
  • 11. Services ● Components that run in the background ● No UI (faceless) ● Poll requests, Downloads, MP3 Playback ● Bound and Unbound ● Bound services are managed by an Activity ● Unbound services are expected to manage  themselves. ● Runs in the main thread, unless otherwise specified ● In the event of CPU intensive or blocking operations  create a new thread.    
  • 13. Content Providers ● The only way to share data between applications. ● You must ask for permission to these assets. ● Access to several types of data ● Alarm Clock, Browser, Contacts, Media (Music,  Video, Images), System Level Settings, User  Dictionary ● Each application can utilize exiting and define their  own. ● Generally utilized through SQLite    
  • 14. Application Manifest    
  • 15. Application Manifest ● Every application MUST have an  ApplicationManifest.xml file. ● It tells Android about your application ● The package name ● Application components (Activities / Services /  Broadcast Receivers / Content Providers) ● Permissions required / requested ● Minimum and Target SDK versions ● Linked Libraries    
  • 17. Application Manifest: Legal Elements ● action ● permission­group ● activity ● permission­tree ● activity­alias ● provider ● application ● receiver ● category ● service ● data ● supports­screens ● grant­uri­permission ● uses­configuration ● instrumentation ● uses­feature ● intent­filter ● uses­library ● manifest ● uses­permission ● meta­data ● uses­sdk     ● permission
  • 18. Resources and UI    
  • 19. Resources ● Resources are contained in the /res folder ● Resource Types: – anim: Tween Animations – color: State List of Colors – drawable: Bitmaps aka Images – layout: UI on Screen – menu: Options Menu / Context Menu / Sub Menu – raw: Files you'd open with Input Stream – values: Arrays, Colors, Dimensions, Strings,  Styles – xml: configuration / search­able configuration    
  • 20. Resources: The Qualifiers ● Basic resources are stored at the root folders ● Resources have qualifiers that allow you to customize  the experience which separate the folders by a dash. ● Localization (Country / Region / Language) ● Screen (Size / Touch / Orientation / Ratio / Density) ● Navigation (State / Method) ● Dock or Night mode ● API Version ● Generally, you'll keep it simple but have adjustments  for: Orientation, Size and Language.    
  • 21. Resources: An example layout ● Items in red are generic  resources. ● Blue items are qualitative and if  not matched fall back to generic.    
  • 22. Resources: Strings ● The string XML file defines a name (key) for your text ● Stylization is possible with some HTML elements – Bold, Italic, Underline, Monospace, Superscript,  Subscript and Strikethrough (b, i, u, tt, big, small,  sup, sub, strike)    
  • 23. Resources: Layouts ● The Layout is the screen view of your application. ● There are several types of layouts: ● FrameLayout: The simplest layout ● LinearLayout: Aligns children in a single direction ● TableLayout: Most frustrating layout ● RelativeLayout: The most common layout ● There are several other specialty views available to  wrap the layouts ● ScrollView, TabHost, ViewFlipper, GridView, etc.    
  • 24. Resources: Layouts: Elements ● Contained in each layout is generally XML defining  each type of element of widget you want to use. ● From a high level view these include – Button, Checkbox, DatePicker, EditText,  ImageView, ListView, TextView ● You can find all of these in the android.widget  package.    
  • 26. SDK    
  • 27. SDK: Overview ● The SDK contains everything you need to build an  android application, however, to aide you they also  made an eclipse plugin ADT. ● After installing the SDK, I recommend you install the  eclipse plugin – it will save you time later. ● Launch the SDK and install all available packages ● This is useful for testing the emulator with different  versions as well as ensuring you have the Google  API's as well. ● Windows users: You need to ensure you download the  USB driver if you plan to use your phone for testing.    
  • 29. Building An App    
  • 30. Our First Activity: Building the Project ● Before we begin anything we need to start an android  project.  I prefer ant, so creating this project is quick:    
  • 31. Our First Activity: Installing the Project ● We now have an application, that is installable. ● If our emulator is running – we can just run: – ant install ● Note: If you are using an actual device and  you are on linux, you must start the “adb”  server as root: sudo adb start­server    
  • 32. Our First Activity: Changing the Theme and Icon ● I am not a fan of the black background and how the  interface looks, luckily android supports themes! ● Canned Themes can be found in the sdk folder:  platforms/android­ver/data/res/values/themes.xml – We'll use Theme.Light ● Themes can be applied to a whole application, an  activity or an element. – We will change it on the whole application, which  simply requires a change to the  AndroidManifest.xml file. ● Want to make your own theme?   – Extend one of the ones already made.  
  • 34. Our First Activity: Adding a Logo ● Let's take a confoo logo and put it at the top of the  activity. ● Since there is no generic “drawable” resource we'll  make one and store it there. ● We can then reference the image in our xml as  @drawable/confoo ● The activity's layout is current set as “main.xml” in  res/layout    
  • 36. Our First Activity: Updating the Text ● So the canned text is currently hard coded and not  using the res/values/strings.xml file.  Let's change that  and update it.  While we are there we will update the  application name. ● Referencing strings in our application is as easy as  @string/name we'll make this change in our layout  after we add the keys.    
  • 38. Adding A Menu    
  • 39. Adding a Menu: Using res/menu ● To build a menu, we simply need to add an xml file to  res/menu and incorporate it into our code. ● Using the stock icons you can find under the  android­sdk­dir/platforms/android­ver/res/drawable­ * ● We also need to add in code to our activity to make  this menu load. ● We will add in a menu item for the Schedule,  Joind.in and Twitter.    
  • 42. Adding a Menu: Incorporate WebKit ● To make this menu functional let's introduce a browser. ● Here we can use Intents to launch a specific URL in the  browser.    
  • 43. Adding A TabHost    
  • 44. Adding a TabHost ● A TabHost allows us to have several open actions at  once and keep the state of them during that time. ● It also lets us navigate the app slightly easier. ● Let's put the same things that we have in the menu  bar there for now. – But, we need to modify this as well.  Let's use  webkit in our own internal browser. ● This also means we now need to create a tabhost  activity and change the manifest to go to the tab host  activity first.    
  • 51. Signing your Application ● First step in publishing is generating a private key: keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 ● Secondly, if you are using ant and want to automate  release builds modify local.properties with your  passphrase: ● Now, let it rip: ant release   ● Now it is off to market.android.com/publish  
  • 52. Advanced Stuff    
  • 53. Gotchas ● When using an AsyncTask ● Always ensure you check you're still in the view you  need.  Crashing issues apply. ● When using a Progress Dialog ● Ensure it still exists and that it is showing – never  assume it is still existing. ● Some code to give you a better idea:    
  • 55. Gotchas ● If your configuration changes (Orientation Change),  ensure that you stated it in your AndroidManifest as  well as your Activity to handle things such as Progress  Dialogs  ● Android by default will re­create the view and  activity.    
  • 57. Gotchas ● If your server utilizes tokens or some form of sessions ● When you close the application, it will remain in a  background process until android needs memory.   Ensure that you handle this – users become  unhappy otherwise :) ● Before you use the internet make sure that it does  exist :)    
  • 58. C2dm ● Cloud 2 Device Messaging works basically the same  as Apple Push Notification Service, except far more  flexible. ● Your application registers a broadcast receiver and  fires off an intent to register the device.  You receive  back an ID that you subsequently store on your own  server. ● We're talking about how to handle this in your app –  the web server part is far more complex: ● See:  http://blog.digitalstruct.com/2010/11/21/android­ c2dm­with­php­and­zend­framework/    
  • 59. C2dm ● What needs to happen ● Ask for permissions in the manifest, publish a  broadcast receiver and ask google for the  registration ID ● Before that although, you do need to sign up:  http://code.google.com/android/c2dm/index.html    
  • 63. Questions? Mike Willbanks Blog : http://blog.digitalstruct.com Twitter : mwillbanks IRC : lubs on freenode