Android Programming and Technical Programming Technical

What are the various return values of onStartCommand(), and when to use what?

Options
1) START_STICKY - in case if android stops our service forcefully, then restart service by sending intent null
2) START_NOT_STICKY - in case if android stops our service forcefully, then don't restart, until user restarts it.
3) START_REDELIVER_INTENT- in case if android stops our service forcefully, then restart service by sending re-sending the intent.
4) all options are true

Read Solution (Total 1)

Android Other Question

Updating UI from service: How to access progress bar from a service?

Options
1) Send progressbar id through intent extras & access it in service
2) Make progress bar as static variable, and access that variable from service.
3) If you want to touch UI from service, trigger a dynamically registered receiver in activity from service, And update UI from that dynamic receiver with in that activity
4) put all UI controls in a common class and access it from all components.
How to monitor service connection status in bound services?

Options
1) using isServiceConnected(), it returns true if service is connected
2) using onServiceDisConnected(), this function will be called if connection is broken
3) client can keep polling to service if it is available or not.
4) using ServiceConnection class.