Questions tagged [android-intentservice]

The IntentService class provides a straightforward structure for running an operation on a single background thread.

The IntentService class provides a straightforward structure for running an operation on a single background thread. This allows it to handle long-running operations without affecting your user interface's responsiveness. Also, an IntentService isn't affected by most user interface lifecycle events, so it continues to run in circumstances that would shut down an AsyncTask

An IntentService has a few limitations:

  • It can't interact directly with your user interface. To put its results in the UI, you have to send them to an Activity.
  • Work requests run sequentially. If an operation is running in an IntentService, and you send it another request, the request waits until the first operation is finished.
  • An operation running on an IntentService can't be interrupted.

However, in most cases an IntentService is the preferred way to simple background operations.

461 questions
14
votes
1 answer

Android: multiple intentservices or one intentservice with multiple intents?

I'm a little confused about intentService. The docs say that if you send an intentService multiple tasks (intents) then it will execute them one after the other on one separate thread. My question is - is it possible to have multiple intentService…
14
votes
4 answers

Service Automatic Called on Destroying Activity

I am stuck with the problem of Activity + Service in that I have following number of Activities and Services. Activities: LoginActivity => OrderListActivity => AddOrderActivity => ConfirmOrderActivity Services: ReceivingOrderService - Receiving…
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
14
votes
1 answer

Native crash in /system/lib/libart.so

I have an app on the Play Store, it has an IntentService that does some work when the app starts, and it's causing native crashes on Android 5.0. This service just scans the assets folder for app updating purposes. Specifically, this crash seems to…
bigstones
  • 15,087
  • 7
  • 65
  • 82
12
votes
2 answers

IntentService + startForeground vs JobIntentService

Since Android Oreo background execution limits, the docs recommend to refactor IntentServices to JobIntentService. https://developer.android.com/about/versions/oreo/background JobIntentService runs immediately as an IntentService below Oreo, but…
12
votes
1 answer

Default constructor for IntentService (kotlin)

I am new with Kotlin and little bit stack with intentService. Manifest shows me an error that my service doesn't contain default constructor, but inside service it looks ok and there are no errors. Here is my intentService: class MyService :…
Andriy Antonov
  • 1,360
  • 2
  • 15
  • 29
11
votes
1 answer

IntentService is deprecated, how do I replace it with JobIntentService?

Following FetchAddressIntentService implementation with IntentService (in kotlin): class FetchAddressIntentService //Constructor of this service : IntentService(INTENTTAG) { //Receiver where results are forwarded from this service …
11
votes
2 answers

Does FirebaseMessagingService run in the background by default?

Does the FirebaseMessagingService run in the background similar to how an IntentService operates? I see that FirebaseMessagingService extents Service which does not run in the background, but I'd like to be sure whether or not I should be doing any…
11
votes
2 answers

Database operations in IntentService results into application halt,become unresponsive and giving ANR

I am using an IntentService in a alarm manager to trigger it after every 15 seconds. I have to continuously send large amount data to server and receiving large amount of data in response in background. I have to follow beneath process : I am…
11
votes
2 answers

Does intent go queue when calling startService for IntentService multiple times?

I want to download from internet with a IntentService. I pass a url through Intent to IntentService by calling startService(intentserive);. If I call startService for a various intents, do the intents go queue for download?
user3900720
  • 131
  • 2
  • 8
10
votes
2 answers

Asking an IntentService for information about its queue

I have an IntentService that queues up web service calls that need to be made to my web server. So each Intent is a web service call to be made. I'd like to set something up where my application can ask this IntentService if it has any Intents…
Andrew
  • 20,756
  • 32
  • 99
  • 177
10
votes
2 answers

HandlerThread vs IntentService

I would like to ask someone to explain me please, what are the main differences between HandlerThread and IntentService, and what are the main use-case scenarios? I understand that HandlerThread contains a Looper, which managing the messageQueue,…
narancs
  • 5,234
  • 4
  • 41
  • 60
10
votes
6 answers

handler.postDelayed is not working in onHandleIntent method of IntentService

final Handler handler = new Handler(); LOG.d("delay"); handler.postDelayed(new Runnable() { @Override public void run() { LOG.d("notify!"); //calling some methods here } }, 2000); The "delay" does shows in the log, but not…
9
votes
3 answers

Is there any development pattern that can replace an IntentService for network requests?

In the current app that I am developing with a co-worker, we're using IntentServices with Volley calls inside to process RESTful API network requests. It's just simple JSON string data, and some small images. My question to those experienced in…
9
votes
6 answers

Should I use Service or IntentService for my android app?

Please correct me If I am wrong : 1) A Service is used to perform long tasks in background. A service runs in the UI thread so if there comes a long task then it may freeze our UI. A service will continue to run independent of application as long…
Rakesh
  • 1,133
  • 4
  • 13
  • 28
8
votes
2 answers

How to remove duplicate intent from JobIntentService

I have a JobIntentService that is launched every time a push notification comes in to tell the service to go fetch more data. While the app is in the foreground everything works as it should. When the app is in the background and multiple push…
tyczj
  • 71,600
  • 54
  • 194
  • 296
1
2
3
30 31