Multiple choice

onStartCommand() method of service gets called when

  1. service is started through activity

  2. service binds with any component

  3. Both (1) and (2)

  4. None of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

onStartCommand() is called when a service is explicitly started using startService(). Binding with bindService() triggers onBind() instead. The two initiation methods have different lifecycle callbacks.