Service

The Service creates a status bar notification but does not do much of anything else. It does not create a separate process or thread. See Application Components: Services and Bound Services. Class Service.

Source code in Service.zip

  1. ServiceActivity.java
  2. LocalService.java
  3. R.java
  4. main.xml
  5. AndroidManifest.xml declares the service

Start and Stop the Service

startService calls onStartCommand, stopService calls onDestroy.

ApiDemos/App/Service