CS4521:   Mobile and Topics in Web Programming

Android Services

  • perform background tasks without providing an UI
  • can notify the user via the notification framework in Android

 

  • perform a longer-running operation while not interacting with the user
  • can be started and stopped
  • doesn't have GUI
  • run by activities
  • implicit Service (binding service)
  • explicit Service (start service)

 

Service Lifecycle

void onCreate()  
void onStart(Intent intent)  
void onDestroy()

Examples --but it is up to your imagination

  • checking for updates to an RSS feed
  • playing back music even if the controlling activity is no longer operating

 

 

 
© Lynne Grewe