what service class should I use for the stopwatch that will run on the background
Which one should I use in terms of performance.
what service class should I use for the stopwatch that will run on the background
Which one should I use in terms of performance.
Here is an old question with loads of answers regarding differences between Service and IntentService. Maybe you can find something there.
From personal experience i'd say they are not that much different. Just the way you use them. I would say stick with the one you think fits your application best overall.
You should use foreground service (with Service instead of IntentService
) in this case.
Reasons:
long thread
& start-sticky
then your app is being suspected by optimization apps and OS. Your app will be considered battery draining.Intentservice
kills itself when work is done. Whether normal Service fits your requirement where only you have controls of your service.Solution:
As i said make normal service as foreground service. See here. That will notify user till your service is running. And it will not be killed by OS due to any above reason.