Questions tagged [intentservice]

IntentService is a special implementation of Android service component.

IntentService is a special implementation of Android service component that handles asynchronous requests (expressed as Intents) on demand, one at a time. The service is started when Intent is received, handles each Intent in turn using a worker thread, and stops itself when it runs out of work.

All requests are handled on a single worker thread -- they may take as long as necessary (and will not block the application's main loop), but only one request will be processed at a time.

1118 questions
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
12
votes
1 answer

Android application crashes when I start an IntentService

My application crashes as soon as I start an IntentService. I'm trying to make the intentservice read accelerometer data. I intend to use a partial-wake lock to keep it on even when the screen is off. So the intentService extends from…
user3927312
  • 814
  • 2
  • 13
  • 27
12
votes
4 answers

Android Alert dialog from inside an intent service

I want to display an alert dialog from inside an intent service. AlertDialog alertDialog = new AlertDialog.Builder(this).create(); This throws the following exception Unable to add window — token null is not for an application I have…
12
votes
2 answers

How to force stop Intent Service in progress?

I have an intent service which downloads several gigabytes of videos. I have a "Stop" button, to stop the download if accidentally hit "Start" or whatever. I know this has been asked a couple of times but with no working answer for me. I try to call…
urSus
  • 12,492
  • 12
  • 69
  • 89
12
votes
6 answers

Android IntentService not starting

I know this question has been asked many times, but all the other threads didn't solve my issue at all, I can't see anything wrong with my code. Maybe I missed something here, can anyone help me out? Code for the Intent Service: package…
thedjaney
  • 1,126
  • 2
  • 10
  • 28
12
votes
2 answers

Android IntentService Instantiation error

Possible Duplicate: Android RuntimeException: Unable to instantiate the service I am downloading my data using IntentService. My IntentService class definition is as follows: public class DownloadService extends…
Debopam Mitra
  • 1,842
  • 4
  • 27
  • 51
11
votes
1 answer

How to Collect info from IntentService and Update Android UI

I'm learning Android and I'm stuck with my service. My application connects via Socket to my server every X seconds, receives an XML, parses the information and it's shows in a TextView. I'd like to know how can I implement an IntenService to do…
Fabricio
  • 135
  • 1
  • 1
  • 5
11
votes
4 answers

Send location updates to IntentService

How can location updates be sent directly to Intent Service? The following approach does not work. OnConnected function is called but then the intent is never received in the service: ... private PendingIntent getLocationPendingIntent(boolean…
M T
  • 968
  • 1
  • 8
  • 24
11
votes
3 answers

Why would LocalBroadcastManager not work instead of Context.registerReceiver?

I had to implement a feature to this app which consists of an Activity and a Service working on the background (it implements Service, not IntentService). I went through a few tutorials on the Internet that are supposed to work, and they all use…
Teo Inke
  • 5,928
  • 4
  • 38
  • 37
11
votes
3 answers

Keeping alive Intent Service after application is killed

I have intent service in my app. This service has some job to do - uploading some files. It runs only when there is something to do. Service won't upload when some conditions are met, for example no Internet connection. For that reason it registers…
Ari
  • 3,101
  • 2
  • 27
  • 49
11
votes
7 answers

Async task does not work properly (doInBackground not executing) when service runs in background, Android

I noticed that sometimes Async task does not work properly , Actually its doInBackground() method does not get called , this happens mostly when any service run in background for that activity. For Example , when music runs in background with…
10
votes
2 answers

Send a broadcast only to specific Activity

I have one Activity which creates a BroadcastReceiver with an IntentFilter in the method onCreate(...): IntentFilter iFilter = new IntentFilter("action"); receiver = new BroadcastReceiver() { @Override public void onReceive(Context…
CSchulz
  • 10,882
  • 11
  • 60
  • 114
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
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…
1 2
3
74 75