-2

Is it possible to start a service without starting an activity? My plan is to write an application which shows a notification when Bluetooth device is connected and a headset Thanks for answers

Philxw
  • 39
  • 4

1 Answers1

-1

Services ONLY can be started from Android components , such as Activity , BroadcastReceiver and either from another service. Anyway to start a service you need a Context , Because you're gonna call Context.startService(i).

In your case I suggest you to start your service from a BroadcastReceiver as same as this one : How to detect when a user plugs headset on android device? (Opposite of ACTION_AUDIO_BECOMING_NOISY)

AmirHmZ
  • 9
  • 5