Reputation: 2568
i'm creating a sales application. And i'm wondering whether to use multiple IntentService to manage background work(ex. one for managing point of sale upload and download, one to store sales and one to download the product) or to use a single IntentService for all operations?
Upvotes: 1
Views: 407
Reputation: 66989
I would use separate IntentServices, so that your sales transactions are never blocked. This will also keep the code for each IntentService cleaner, since there would not be code for 3 different areas of concern in one place.
Upvotes: 0
Reputation: 49986
It depends on requirements of your application, if you use single IntentService
for all your tasks, you will not be able to download product and send sales information at the same time, all tasks will be queued, if you are OK with that then no problem. Actually it might be a lot easier to code application with single IntentService that with multiple. You will not have to worry about synchronization of tasks, also IMO debugging will be easier.
From your description I can give you one use case when single IntentService might cause problems in UI. Suppose you issued task of sending sales data and connection is quite slow (or maybe server is blocked?), then if user will select new product to look at it, then product download data will be also blocked.
Upvotes: 1