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
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.
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
Options
1) I can use a Fragment with out an Activity
2) A fragment can have multiple activities in it.
3) An activity can contain multiple fragments in it.
4) A fragment designed in one activity can't reused in other activity
What is the life cycle of foreground activity in android?
Options
1) onCreate() −> onStart() −> onResume() −> onStop() −> onRestart
2) onCreate() −> onStart() −> onResume() −>onStop()
3) onCreate() −> onStart() −> onResume()
4) None of the Above