1 package de.cweiske.headphoneindicator;
3 import android.app.Service;
4 import android.content.Intent;
5 import android.content.IntentFilter;
6 import android.os.IBinder;
9 * Permanent service that runs even when the app itself is stopped
11 * @author Christian Weiske, cweiske@cweiske.de
13 public class BackgroundService extends Service
15 protected NotificationReceiver notificationReceiver;
18 public void onCreate() {
20 IntentFilter filter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
21 this.notificationReceiver = new NotificationReceiver();
22 registerReceiver(this.notificationReceiver, filter);
26 public void onDestroy() {
27 unregisterReceiver(this.notificationReceiver);
31 public IBinder onBind(Intent intent) {
36 public int onStartCommand(Intent intent, int flags, int startId) {