Android101 - Intro and Basics

302 views

Published on

A quick rundown on the Android architecture and main components.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
302
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Android101 - Intro and Basics

  1. 1. Android 101 Part 1. Introduction, basics, and your environment
  2. 2. While we wait…  Android ADT Bundle  http://developer.android.com/sdk/index.ht ml  Genymotion  http://www.genymotion.com/
  3. 3. Prerequisites  OOP Language Experience  Computer (Mac/Linux/Windows)  Plus:  Java – programming  XML – layouts and resources  Command Line – general commands
  4. 4. What is Android?  Platform  The operating system  Framework  Set of APIs to develop for the platform  SDK  Set of tools (including the framework) to assist developing for the platform
  5. 5. Source: http://www.armdesigner.com/NewsLook617.html
  6. 6. Android and Google  Android is open source (AOSP)  Google is the owner/maintainer  Source: http://source.android.com  GApps  Google specific closed source apps  Google Play Store  Google Play Services  Google Maps  …
  7. 7. Uses for Android?  Calls  Music  Videos  Games  Social  …  Educational  Commercial (POS)  Satellite  Security  Accessory  …
  8. 8. Android vs iOS  Open Source  Java / XML  78.4% MS Worldwide  50.6% MS USA  $100-$200/month  800,000 apps  ~$130,000 senior dev  Closed Source  Objective-C  17.6% MS Worldwide  43.9% MS USA  $500-$1000/month  800,000 apps  ~$120,000 senior dev
  9. 9. Versions (OS vs API)
  10. 10. Components In context of our demo application
  11. 11. Demo Application  Features:  Displays lists of saved notes  Allows user to add and edit notes  Can record notes  Can playback notes  Stops recording or playback when a call is incoming or made
  12. 12. Step 1: Display We need to display a few screens to the user…
  13. 13. Activities  Represents a single screen extends Activity class
  14. 14. Fragments  Represents a section of the screen  An Activity coordinates the Fragment(s)  Fragments can be reused extends Fragment class
  15. 15. Step 2: Persist Data We need to persist the notes the user adds…
  16. 16. ContentProvider  Manages data  Can use almost any storage option  SQLite  File  Remote Server  …  Provides consistent interface (CRUD)  Can be restricted with permissions extends ContentProvider class
  17. 17. Step 3: Record/Play Audio We need to record or play audio while allowing for multitasking…
  18. 18. Services  Used to perform in the background  Service class works in main thread  IntentService (child class) works in background thread  Background = No user interface extends Service class
  19. 19. Step 4: Phone state We need to stop/pause audio playback or recording…
  20. 20. BroadcastRecievers  Listens to system-wide events  Incoming SMS  Alarm  Network State  …  Usually triggers a larger action extends BroadcastReciever class
  21. 21. Using the Components
  22. 22. AndroidManifest.xml  Declares:  Permissions used  Libraries required  Hardware required  Package name (must be unique)  Application name  Components  Activity <activity>  Service <service>  ContentProvider <provider>  BroadcastReciever <reciever>  …
  23. 23. Intents (options)  Component Name  The name of the component to start  Action  Examples: VIEW, EDIT, PICK  Data  Uri to the data  Examples: Image, URL, Document  Category  Examples: Browsable, Launcher  Extras  Key-value pairs of data to pass to the component  Flags  Used to tell the Android system how to launch certain components extends Intent class
  24. 24. IntentFilters  action  name  android.intent.action.SEND  com.example.whatever.DO_IT  data  mimeType  scheme  host  port  path  …  category  BROWSABLE  LAUNCHER  DEFAULT
  25. 25. Intents  Explicit Intent  Intent to start a specific component you know exists, such as from your app or a system component  new Intent(this, SecondActivity.class)  Implicit Intent  Intent to do a general action and possibly allow other applications to handle it  new Intent(Intent.ACTION_VIEW, Uri.parse(“http://google.com”)) extends Intent class
  26. 26. Resources A very quick glimpse
  27. 27. Resources  animator  anim  color  drawable  layout  menu  raw  values  arrays  colors  dimens  strings  styles  xml res/ directory
  28. 28. Resources (qualifiers)  Language and region  Layout direction  Smallest Width  Available Width  Available Height  Screen size  Screen Aspect  Screen Orientation  UI Mode  Screen Pixel Density  Platform Version  … res/ directory
  29. 29. Environment Setting it up
  30. 30. Environment - Java JDK  Java 7 JDK - http://goo.gl/zXjC  To confirm: … run: javac –version … output: javac 1.7.0_45
  31. 31. Environment - ADT Bundle  ADT Bundle - http://goo.gl/2qpr  Eclipse + ADT Plugin  Android SDK Tools  Android Platform Tools  Latest Android platform  Latest Android System image

×