What will happen if you start a service with out any thread, that does heavy functionality?
i. Nothing will happen, it runs finely.
ii. May lead to ANR (application not responding) error some times.
iii. option 2 is right, but that is applicable if your application is having at least one activity, since that activity will run in UI thread.
iv. option 2 is right, whether you have at least one activity or not in your application.
Since android gives only one thread per application, default all activities will run in that thread. but service also performs long running operations in the background, it is not suggestible to run service also in the same thread which may hang your activities which lead to ANR.
Back To Top