Your SlideShare is downloading. ×
APPLICATION LIFECYCLE
Application lifecycles Applications and processes may transition  between several states   active   paused   stopped  ...
Android lifecycle methods Lifecycle state transitions trigger event  callback methods Callback events differ based on ty...
Android Activity                           Activity.                       Activity.            Activity.                 ...
Activity callback methods Implementation of lifecycle method should  always first call superclass         protected void ...
Activity transition     Activity A   Activity B     ActivityA.     onPause                  ActivityB.                  on...
Android ServiceService.       Service.                               Service.onCreate   onStartCommand                    ...
Service binding methods        Activity           Service      bindService()                           .onBind()   Service...
Android BroadcastReceiver                BroadcastReceiver.                    onReceive Only active while handling onRec...
Android ContentProvider                  ContentProvider.                     onCreate Only active while handling methods...
Processes and lifecycles Old processes removed when memory runs  low Selection base on importance hierarchy  1.   Foregr...
iOS Application lifecycle UIApplication notified of state transition  events   Handled by application delegate     appl...
Pre – iOS 4      application:didFinishLaunchingWithOptions:             applicationDidBecomeActive:                       ...
iOS Application launch
iOS Transition to background
iOS Return to foreground
iOS Interruption handling          UIKit                      Delegate         Active Phone, SMS, or Calendar             ...
iOS 4 Application lifecycle      application:didFinishLaunchingWithOptions:             applicationDidBecomeActive:  Ignor...
Reminder Proposal due Wednesday
Upcoming SlideShare
Loading in...5
×

iOS Application Lifecycle

9,912

Published on

Published in: Technology, Business

Transcript of "iOS Application Lifecycle"

  1. 1. APPLICATION LIFECYCLE
  2. 2. Application lifecycles Applications and processes may transition between several states  active  paused  stopped  inactive  suspended Callback methods allow applications to prepare for and respond to transitions
  3. 3. Android lifecycle methods Lifecycle state transitions trigger event callback methods Callback events differ based on type of component Callback methods take place in foreground and should be brief
  4. 4. Android Activity Activity. Activity. Activity. Activity. Activity. Activity. onRestore onSave onStart onResume onPause onStop InstanceState InstanceStateActivity. Activity.onCreate onDestroy Activity. onRestart Active lifetime Visible lifetime Full lifetime Application is killable
  5. 5. Activity callback methods Implementation of lifecycle method should always first call superclass protected void onPause() { super.onPause(); . . . }
  6. 6. Activity transition Activity A Activity B ActivityA. onPause ActivityB. onCreate ActivityB. onStart ActivityB. onResume ActivityA. onStop
  7. 7. Android ServiceService. Service. Service.onCreate onStartCommand onDestroy Service. Service. onBind onUnbind Service. onRebind
  8. 8. Service binding methods Activity Service bindService() .onBind() ServiceConnection. onServiceConnected unbindService() .onUnbind() ServiceConnection. onServiceDisconnected
  9. 9. Android BroadcastReceiver BroadcastReceiver. onReceive Only active while handling onReceive() method
  10. 10. Android ContentProvider ContentProvider. onCreate Only active while handling methods supporting ContentResolver  query()  insert()  update()  delete()  getType()
  11. 11. Processes and lifecycles Old processes removed when memory runs low Selection base on importance hierarchy 1. Foreground process 2. Visible process 3. Service process 4. Background process 5. Empty process
  12. 12. iOS Application lifecycle UIApplication notified of state transition events  Handled by application delegate  application:didFinishLaunchingWithOptions:  applicationDidBecomeActive:  applicationWillResignActive:  applicationDidEnterBackground:  applicationWillEnterForeground:  applicationWillTerminate:
  13. 13. Pre – iOS 4 application:didFinishLaunchingWithOptions: applicationDidBecomeActive: Active applicationWillTerminate:
  14. 14. iOS Application launch
  15. 15. iOS Transition to background
  16. 16. iOS Return to foreground
  17. 17. iOS Interruption handling UIKit Delegate Active Phone, SMS, or Calendar applicationWillResignActive: notification arrives Ignore Yes applicationDidBecomeActive: ? No Application moves to applicationDidEnterBackground: background
  18. 18. iOS 4 Application lifecycle application:didFinishLaunchingWithOptions: applicationDidBecomeActive: Ignoreinterrupt Active applicationWillEnterForeground: applicationWillResignActive: applicationDidEnterBackground: Suspended applicationWillTerminate:
  19. 19. Reminder Proposal due Wednesday

×