Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Mobile Application Development Framework 4/16/2009 Richard Yang
Recap <ul><li>What are the major considerations in developing a software environment and application framework for mobile ...
Recap: TinyOS <ul><li>Software components provide commands and require callback hooks </li></ul><ul><li>A configuration li...
Recap: J2ME/.NetCF <ul><li>Scale down a popular programming environment to ease learning </li></ul><ul><li>Use virtual mac...
Application Framework (Android):  Key Concepts <ul><li>Activity </li></ul><ul><ul><li>Visible screen for user interaction ...
Andriod Features <ul><li>Linux kernel as foundation </li></ul><ul><li>Java based framework (J2SE not J2ME) </li></ul><ul><...
Andriod
Activity  (Visual User Interaction)
Discussion: Key Issues in Designing Activity Support in Mobile Env. <ul><li>Constrained display screen </li></ul><ul><ul><...
MIDP: GUI <ul><li>Implementations control the look and layout of screen components </li></ul>Title High-level Components T...
MIDP: Visual Display Management  <ul><li>Display   </li></ul><ul><ul><li>the manager of the display and input devices  </l...
<ul><li>Similar to J2SE GUI but reduced </li></ul>MIDP: GUI <ul><li>Lists </li></ul><ul><li>Text Boxes </li></ul><ul><li>A...
MIDP: Visual Display <ul><li>Displayable </li></ul><ul><ul><li>Canvas </li></ul></ul><ul><ul><ul><li>GameCanvas </li></ul>...
MIDP: User Interaction <ul><li>Displayable  objects can declare commands and declare a command listener: </li></ul><ul><ul...
MIDP: Lifecycle <ul><li>MIDlets move from state to state in the lifecycle, as indicated </li></ul><ul><ul><li>start – acqu...
Example <ul><li>See HelloMIDlet.java </li></ul>
Check on MIDP  <ul><li>Constrained display screen </li></ul><ul><ul><li>Display components </li></ul></ul><ul><ul><li>Layo...
MIDP: Persistent State  <ul><li>Record store defined in javax.microedition.rms </li></ul><ul><li>Record store identified b...
<ul><li>Android Activity Life cycle </li></ul>
Android Service Life Cycle <ul><li>void onCreate()  </li></ul><ul><li>void onStart(Intent  intent )  </li></ul><ul><li>voi...
Android: Visual Display <ul><li>Similar to J2SE </li></ul><ul><li>Interesting feature: using xml resources for GUI managem...
Example http://developer.android.com/guide/tutorials/views/hello-tablelayout.html see tablelayout.xml
Example: Calculator
Check on Android <ul><li>Constrained display screen </li></ul><ul><ul><li>Display components </li></ul></ul><ul><ul><li>La...
Persistent Data Storage <ul><li>Preference </li></ul><ul><ul><li>store and retrieve key-value pairs of primitive data type...
Inter-Activity Data Exchange
MIDP <ul><li>Uses Record Store </li></ul><ul><ul><li>static String[] listRecordStores()  </li></ul></ul>
Android: Content Provider <ul><li>Each provider can expose its data as a simple table on a database model </li></ul><ul><l...
Android: Content Provider <ul><li>See ContentProvider for query example </li></ul>
Inter-Activity Service/Event Discovery
Intent <ul><li><Component name> [optional] </li></ul><ul><li>Action </li></ul><ul><li>Data, e.g., mpeg </li></ul><ul><li>C...
Intent <ul><li>An Intent object is passed to  Context.startActivity()  or  Activity.startActivityForResult()  to launch an...
Intent Resolution <ul><li>Explicit intents: component identified </li></ul><ul><li>Implicit intents </li></ul><ul><ul><li>...
Intent filter action category data
Android: Broadcast Receiver <ul><li>Sending a broadcast: </li></ul><ul><ul><li>Context.sendBroadcast(Intent intent, String...
Upcoming SlideShare
Loading in …5
×

Operating System Support for Mobile Devices

616 views

Published on

  • Be the first to comment

  • Be the first to like this

Operating System Support for Mobile Devices

  1. 1. Mobile Application Development Framework 4/16/2009 Richard Yang
  2. 2. Recap <ul><li>What are the major considerations in developing a software environment and application framework for mobile wireless applications? </li></ul><ul><ul><li>Handle heterogeneous devices/configurations </li></ul></ul><ul><ul><li>Efficient (memory, battery, …) </li></ul></ul><ul><ul><li>Easy programming for event-driven programming </li></ul></ul><ul><ul><li>… </li></ul></ul>
  3. 3. Recap: TinyOS <ul><li>Software components provide commands and require callback hooks </li></ul><ul><li>A configuration links components and uses only necessary components </li></ul><ul><li>Two threads </li></ul><ul><ul><li>one for event </li></ul></ul><ul><ul><li>one for task </li></ul></ul>ADC.nc interface ADC { async command result_t getdata();   async command result_t getContinuousData();   event result_t dataReady(uint 16_t data); } configuration SenseTask { // this module does not provide any interfaces } implementation { components Main, SenseTaskM, LedsC, TimerC, DemoSensorC as Sensor; Main.StdControl -> TimerC; Main.StdControl -> Sensor; Main.StdControl -> SenseTaskM; SenseTaskM.Timer -> TimerC.Timer[unique(&quot;Timer&quot;)]; SenseTaskM.ADC -> Sensor; SenseTaskM.Leds -> LedsC; }
  4. 4. Recap: J2ME/.NetCF <ul><li>Scale down a popular programming environment to ease learning </li></ul><ul><li>Use virtual machines to mask device heterogeneity </li></ul><ul><li>Use versioning to handle configuration heterogeneity and avoid using lowest common denominator </li></ul><ul><li>Provide classes to support user-interface driven applications </li></ul>
  5. 5. Application Framework (Android): Key Concepts <ul><li>Activity </li></ul><ul><ul><li>Visible screen for user interaction </li></ul></ul><ul><li>Service </li></ul><ul><ul><li>Background services </li></ul></ul><ul><li>Content provider </li></ul><ul><ul><li>Shared data </li></ul></ul><ul><li>Service/Event discovery </li></ul><ul><ul><li>Broadcast receivers: Receive and react to broadcast events </li></ul></ul><ul><ul><li>Intent and Intent Filter </li></ul></ul>
  6. 6. Andriod Features <ul><li>Linux kernel as foundation </li></ul><ul><li>Java based framework (J2SE not J2ME) </li></ul><ul><li>Dalvik Virtual machine </li></ul>
  7. 7. Andriod
  8. 8. Activity (Visual User Interaction)
  9. 9. Discussion: Key Issues in Designing Activity Support in Mobile Env. <ul><li>Constrained display screen </li></ul><ul><ul><li>Solution: specially simple display components </li></ul></ul><ul><ul><li>Need “smart” layout management </li></ul></ul><ul><ul><li>Event handling of UI </li></ul></ul><ul><li>Lifecycle support </li></ul><ul><ul><li>May need frequent resource (memory) release/acquisition </li></ul></ul><ul><ul><li>Fast switch between activities/screens </li></ul></ul><ul><ul><li>Frozen app. Management </li></ul></ul><ul><ul><li>Persistent state management </li></ul></ul>
  10. 10. MIDP: GUI <ul><li>Implementations control the look and layout of screen components </li></ul>Title High-level Components Ticker tape (Optional; device manufacturer can place it at the top or bottom of the screen)
  11. 11. MIDP: Visual Display Management <ul><li>Display </li></ul><ul><ul><li>the manager of the display and input devices </li></ul></ul><ul><ul><li>Each MIDP has one instance of Display </li></ul></ul><ul><ul><ul><li>Display.getDisplay(this) to get the manager </li></ul></ul></ul><ul><ul><ul><li>At any instance of time at most one Displayable object can be shown on the display device and interact with user </li></ul></ul></ul><ul><ul><ul><ul><li>display.setCurrent(<Displayable object>) </li></ul></ul></ul></ul>
  12. 12. <ul><li>Similar to J2SE GUI but reduced </li></ul>MIDP: GUI <ul><li>Lists </li></ul><ul><li>Text Boxes </li></ul><ul><li>Alerts </li></ul><ul><li>Forms </li></ul><ul><li>Form Items </li></ul><ul><ul><li>Labels </li></ul></ul><ul><ul><li>Image Items </li></ul></ul><ul><ul><li>String Items </li></ul></ul><ul><ul><li>Text Fields </li></ul></ul><ul><ul><li>Date Fields </li></ul></ul><ul><ul><li>Gauges </li></ul></ul><ul><ul><li>Choice Groups </li></ul></ul>
  13. 13. MIDP: Visual Display <ul><li>Displayable </li></ul><ul><ul><li>Canvas </li></ul></ul><ul><ul><ul><li>GameCanvas </li></ul></ul></ul><ul><ul><li>Screen </li></ul></ul><ul><ul><ul><li>Alert, List, TextBox, Form </li></ul></ul></ul><ul><li>Form can contain multiple form items for organization </li></ul><ul><ul><li>Labels, Image Items, String Items, Text Fields, Date Fields, Gauges, Choice Groups </li></ul></ul>
  14. 14. MIDP: User Interaction <ul><li>Displayable objects can declare commands and declare a command listener: </li></ul><ul><ul><li>addCommand(Command cmd) </li></ul></ul><ul><ul><li>addCommandListener() </li></ul></ul><ul><li>Command(<label>, <type>, <priority>) </li></ul><ul><ul><li>Type: BACK, CANCEL, EXIT, HELP, ITEM, OK, SCREEN, and STOP </li></ul></ul>
  15. 15. MIDP: Lifecycle <ul><li>MIDlets move from state to state in the lifecycle, as indicated </li></ul><ul><ul><li>start – acquire resources and start executing </li></ul></ul><ul><ul><li>pause – release resources and become quiescent (wait) </li></ul></ul><ul><ul><li>destroy – release all resources, destroy threads, and end all activity </li></ul></ul>Pause Active Destroyed startApp destroyApp pauseApp destroyApp
  16. 16. Example <ul><li>See HelloMIDlet.java </li></ul>
  17. 17. Check on MIDP <ul><li>Constrained display screen </li></ul><ul><ul><li>Display components </li></ul></ul><ul><ul><li>Layout management </li></ul></ul><ul><ul><li>Event handling of UI </li></ul></ul><ul><li>Lifecycle support </li></ul><ul><ul><li>May need frequent resource (memory) release/acquisition </li></ul></ul><ul><ul><li>Fast switch between activities/screens </li></ul></ul><ul><ul><li>Frozen app. Management </li></ul></ul><ul><ul><li>Persistent state management </li></ul></ul>
  18. 18. MIDP: Persistent State <ul><li>Record store defined in javax.microedition.rms </li></ul><ul><li>Record store identified by name: </li></ul><ul><ul><li>recordStore = RecordStore.openRecordStore(&quot;scores&quot;, true); </li></ul></ul><ul><ul><li>recordId = addRecord(byte[] data, int offset, int numBytes); </li></ul></ul><ul><ul><li>getRecord(int recordId); </li></ul></ul>
  19. 19. <ul><li>Android Activity Life cycle </li></ul>
  20. 20. Android Service Life Cycle <ul><li>void onCreate() </li></ul><ul><li>void onStart(Intent intent ) </li></ul><ul><li>void onDestroy() </li></ul>
  21. 21. Android: Visual Display <ul><li>Similar to J2SE </li></ul><ul><li>Interesting feature: using xml resources for GUI management </li></ul>
  22. 22. Example http://developer.android.com/guide/tutorials/views/hello-tablelayout.html see tablelayout.xml
  23. 23. Example: Calculator
  24. 24. Check on Android <ul><li>Constrained display screen </li></ul><ul><ul><li>Display components </li></ul></ul><ul><ul><li>Layout management </li></ul></ul><ul><ul><li>Event handling of UI </li></ul></ul><ul><li>Lifecycle support </li></ul><ul><ul><li>May need frequent resource (memory) release/acquisition </li></ul></ul><ul><ul><li>Fast switch between activities/screens </li></ul></ul><ul><ul><li>Frozen app. Management </li></ul></ul><ul><ul><li>Persistent state management </li></ul></ul>
  25. 25. Persistent Data Storage <ul><li>Preference </li></ul><ul><ul><li>store and retrieve key-value pairs of primitive data types, e.g., font, greeting </li></ul></ul><ul><ul><li>See preference.java </li></ul></ul><ul><li>File </li></ul><ul><li>SQL </li></ul>
  26. 26. Inter-Activity Data Exchange
  27. 27. MIDP <ul><li>Uses Record Store </li></ul><ul><ul><li>static String[] listRecordStores() </li></ul></ul>
  28. 28. Android: Content Provider <ul><li>Each provider can expose its data as a simple table on a database model </li></ul><ul><li>Each content provider exposes a public URI that uniquely identifies its data set: </li></ul><ul><ul><li>android.provider.Contacts.Phones.CONTENT_URI android.provider.Contacts.Photos.CONTENT_URI android.provider.CallLog.Calls.CONTENT_URI android.provider.Calendar.CONTENT_URI </li></ul></ul>
  29. 29. Android: Content Provider <ul><li>See ContentProvider for query example </li></ul>
  30. 30. Inter-Activity Service/Event Discovery
  31. 31. Intent <ul><li><Component name> [optional] </li></ul><ul><li>Action </li></ul><ul><li>Data, e.g., mpeg </li></ul><ul><li>Category, e.g., browserable </li></ul>
  32. 32. Intent <ul><li>An Intent object is passed to Context.startActivity() or Activity.startActivityForResult() to launch an activity or get an existing activity to do something new. </li></ul><ul><li>An Intent object is passed to Context.startService() to initiate a service or deliver new instructions to an ongoing service. Similarly, an intent can be passed to Context.bindService() to establish a connection between the calling component and a target service. It can optionally initiate the service if it's not already running. </li></ul><ul><li>Intent objects passed to any of the broadcast methods (such as Context.sendBroadcast() , Context.sendOrderedBroadcast() , or Context.sendStickyBroadcast() ) are delivered to all interested broadcast receivers. Many kinds of broadcasts originate in system code. </li></ul>
  33. 33. Intent Resolution <ul><li>Explicit intents: component identified </li></ul><ul><li>Implicit intents </li></ul><ul><ul><li>System matches an intent object to the intent filters of others </li></ul></ul>
  34. 34. Intent filter action category data
  35. 35. Android: Broadcast Receiver <ul><li>Sending a broadcast: </li></ul><ul><ul><li>Context.sendBroadcast(Intent intent, String receiverPermission) </li></ul></ul><ul><ul><li>Context.sendOrderedBroadcast() </li></ul></ul><ul><li>Receiving broadcast: </li></ul><ul><ul><li>Intent registerReceiver (BroadcastReceiver receiver, IntentFilter filter) </li></ul></ul>

×