Introducing Android




                             Cory Maksymchuk
                cory.maksymchuk@protegra.com
                   cory.maksymchuk@gmail.com
Today


•   Java is dead?
•   What is Android and why was it made?
•   Open?
•   Money?
•   Overview of android architecture
•   Sample Application
Java is Dead
Android
Worldwide Smart Phone Market share

•   2009 – 3.9%
•   2010 – 23%
•   2011 – 38%
•   2012 – 49%
•   3 years = 500 million smart phones running Android
Why Java?


•   Mature Language
•   Massive open source community
•   Excellent tools/IDEs
•   Large, slow bloated Virtual Machine
    - Dalvik = Small, fast optimized Virtual Machine


• All benefits, no disadvantages
    - Except?
What is Android?
How was growth achieved?

•   Operating system, built on Linux
•   Compiler, debugger, emulator, VM
•   Open sourced code under Apache 2 license
•   Open Handset Alliance – 84’ish Companies
    -   Why?
    -   Open standards to allow it to grow
    -   Ability to compete – Apple, Symbian/Nokia, RIM, Microsoft
    -   Google = Smart
• Android vs. iPhone?
Open?


• Yes… but No…
• Open
   - A license that insures the code can be modified, reused and
     distributed
   - A community development approach
   - Assurance the users have total freedom over the device and
     software.
• Google has achieved ½ of openness – Legally Open
  Source
• Is their ‘community development approach’ any different
  than Apple or RIM?
Money?


• What kind of a company is Google?
• How do they make money?
• Android simply makes them better at doing what they’ve
  always done best.
3 Things


• Activities = Screens



• Views/Widgets = Components



• Intents = Messages - used for navigation (among other
  things)
Activities = Screens


• Screens have lifecycles on Mobile devices
   -   onCreate() — Activity is first created
   -   onStart() — Becomes visible
   -   onResume() — Interacting with the user
   -   onPause() — Current activity-> another activity resumed
   -   onStop() — No longer visible to the user
   -   onDestroy() — Before the activity is destroyed
   -   onRestart() — Restarting again
Views


• Basic building block for UI components

                                  Layout




                Widget           ViewGroup




                          View
Views – Cont’d


• To add views to a screen/activity, create hierarchy of
  views, then call setViewGroup(…) in the activity.
• Layout may contain layout and buttons, text fields, radio
  buttons, etc.
Intents = Messages


• Main communication mechanism in Android

1) Used to call other apps or screens – This is us!
2) Send a message to someone who is listening
  -   Low battery
  -   Time zone change
3) Start a service
  -   Download a file
  -   Start/Check the status of a process
Intents/Messages
What do they contain?

• Component name – Unique identifier of component
   - This is an explicit intent
• Activity
   -   ACTION_CALL
   -   ACTION_EDIT
   -   ACTION_SYNC
   -   ACTION_VIEW
• Data
   - URI and MIME type (http://www.protegra.com)
• Category
   - Logical Grouping of activities
• Extras
   - Key/Value pairs
Intent Filters – Intent Resolution


•   Data


•   <intent-filter . . . >
       <action android:name="com.example.project.SHOW_CURRENT" />
       <action android:name="com.example.project.SHOW_RECENT" />
       ...
       <category android:name="android.intent.category.DEFAULT" />
       <category android:name="android.intent.category.BROWSABLE" />
       ...
     <data android:mimeType="video/mpeg" android:scheme="http" . . . />
      <data android:mimeType="audio/mpeg" android:scheme="http" . . . />
    </intent-filter>
Summary


• Screens = Activities
• Screens have components (Views) to manage layouts
  as well as widgets, etc.
• Activities call other Activities, invoke services and send
  messages using Intents
Code

C maksymchuk android

  • 1.
    Introducing Android Cory Maksymchuk cory.maksymchuk@protegra.com cory.maksymchuk@gmail.com
  • 8.
    Today • Java is dead? • What is Android and why was it made? • Open? • Money? • Overview of android architecture • Sample Application
  • 9.
  • 10.
    Android Worldwide Smart PhoneMarket share • 2009 – 3.9% • 2010 – 23% • 2011 – 38% • 2012 – 49% • 3 years = 500 million smart phones running Android
  • 11.
    Why Java? • Mature Language • Massive open source community • Excellent tools/IDEs • Large, slow bloated Virtual Machine - Dalvik = Small, fast optimized Virtual Machine • All benefits, no disadvantages - Except?
  • 12.
    What is Android? Howwas growth achieved? • Operating system, built on Linux • Compiler, debugger, emulator, VM • Open sourced code under Apache 2 license • Open Handset Alliance – 84’ish Companies - Why? - Open standards to allow it to grow - Ability to compete – Apple, Symbian/Nokia, RIM, Microsoft - Google = Smart • Android vs. iPhone?
  • 13.
    Open? • Yes… butNo… • Open - A license that insures the code can be modified, reused and distributed - A community development approach - Assurance the users have total freedom over the device and software. • Google has achieved ½ of openness – Legally Open Source • Is their ‘community development approach’ any different than Apple or RIM?
  • 14.
    Money? • What kindof a company is Google? • How do they make money? • Android simply makes them better at doing what they’ve always done best.
  • 16.
    3 Things • Activities= Screens • Views/Widgets = Components • Intents = Messages - used for navigation (among other things)
  • 17.
    Activities = Screens •Screens have lifecycles on Mobile devices - onCreate() — Activity is first created - onStart() — Becomes visible - onResume() — Interacting with the user - onPause() — Current activity-> another activity resumed - onStop() — No longer visible to the user - onDestroy() — Before the activity is destroyed - onRestart() — Restarting again
  • 19.
    Views • Basic buildingblock for UI components Layout Widget ViewGroup View
  • 20.
    Views – Cont’d •To add views to a screen/activity, create hierarchy of views, then call setViewGroup(…) in the activity. • Layout may contain layout and buttons, text fields, radio buttons, etc.
  • 21.
    Intents = Messages •Main communication mechanism in Android 1) Used to call other apps or screens – This is us! 2) Send a message to someone who is listening - Low battery - Time zone change 3) Start a service - Download a file - Start/Check the status of a process
  • 22.
    Intents/Messages What do theycontain? • Component name – Unique identifier of component - This is an explicit intent • Activity - ACTION_CALL - ACTION_EDIT - ACTION_SYNC - ACTION_VIEW • Data - URI and MIME type (http://www.protegra.com) • Category - Logical Grouping of activities • Extras - Key/Value pairs
  • 23.
    Intent Filters –Intent Resolution • Data • <intent-filter . . . > <action android:name="com.example.project.SHOW_CURRENT" /> <action android:name="com.example.project.SHOW_RECENT" /> ... <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> ... <data android:mimeType="video/mpeg" android:scheme="http" . . . /> <data android:mimeType="audio/mpeg" android:scheme="http" . . . /> </intent-filter>
  • 24.
    Summary • Screens =Activities • Screens have components (Views) to manage layouts as well as widgets, etc. • Activities call other Activities, invoke services and send messages using Intents
  • 25.