Reputation: 85
I have read one post about Android services within threads but there is one thing that I did not understand. In the post the writer uses a custom service because it allows multitasking while IntentService does not.
https://guides.codepath.com/android/managing-threads-and-custom-services#custom-services
Until there everything is okay, but later the writer uses a HandlerThread
which just allow one thread, as my point of view there is no difference between this and a normal IntentService.
Am I right? or is there anything that I am missing? I am looking at this due I want to create a android service able to run different tasks at the same time, should I use ThreadPoolExecutor
instead HandlerThread
?
Upvotes: 0
Views: 122
Reputation: 871
You should make yourself familiar with the changes to background execution introduced with Android 8.0 - you cannot freely execute background work in Service
s anymore the way you could when that tutorial was written.
https://developer.android.com/reference/android/support/v4/app/JobIntentService might be for you; if not, have a look at https://developer.android.com/topic/libraries/architecture/workmanager
Upvotes: 1