Android Programming and Technical Programming Technical

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.

Read Solution (Total 1)

Android Other Question

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
Every application will have by default one thread. True or false?

Options
1) false, by default no threads available for a given application
2) True, always any given application will have default one main thread.
3) True, but it is not always, some times it may not have any thread.
4) both 2 and 3