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
1
vote
0 answers

How can webview keep loading if it was destroyed?

I created a WebVew inside an IntentService onCreate() and tracked (using Log.i) it's lifecycle until IntentService's onDestroy(). I realized that WebView keeps loading after IntentService be destroyed. Can anyone explain me what happens…
1
vote
1 answer

Using MediaPlayer in a Service Class...?

I'm making an app, and currently I'm working on adding background music to it. I've seen a lot of ways to do that, and I've chosen to make it using a Service. My problem, however, comes when I call that Service, due to I hear nothing, the music…
1
vote
0 answers

start IntentService with root privileges

I have Android device with root. When I use permission INJECT_EVENTS from Activity itself it's OK. But I started IntentService from activity and inside IntentService I want to use the permission, but it gives message that service requires…
M. Duisenbayev
  • 309
  • 1
  • 4
1
vote
2 answers

How to open language list page in android Programmatically

I have to open language selection page in android from application. i am using below code. Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName("com.android.settings","com.android.settings.LanguageSettings"); …
AMIT
  • 390
  • 1
  • 4
  • 17
1
vote
1 answer

Android Internet Connection checker OUTSIDE the app

My app needs to do something whenever the internet is connected and vice-versa. However, I need to do this OUTSIDE my application. There are a lot of ideas and help here on stackoverflow but it is always WITHIN the application. I know that the…
1
vote
0 answers

IntentService is the right choice when we need to start and cancel the process during the execution?

I need to read selected file from external storage in background and then using Universal Image Loader download images, while during the process of reading file from external storage or during the image download process user should have a option to…
1
vote
1 answer

Is IntentService appropriate for FileObserver

I need to set a FileObserver on a directory. The observation period is linked to a long running activity, long running because it has a ViewPager with a lot of pages. Instead of placing the FileObserver inside the activity, I was thinking of putting…
Nouvel Travay
  • 6,292
  • 13
  • 40
  • 65
1
vote
1 answer

Clean way to handle multiple intent.getStringExtra within onReceive?

I created a WebService class that handles multiple different requests to a web service, this class Broadcast's and intent with a different key depending on what method was originally called in the WebService class. I'm stuck on how to properly…
1
vote
1 answer

Android Intent Service to run in separate process does not stop itself

I have created an intent service that downloads some files, writes some of them to external storage and some data to my app's local database It was working fine until I realised that the intent service runs in the same process of my app. I want the…
Ersen Osman
  • 7,067
  • 8
  • 47
  • 80
1
vote
1 answer

How can I save a Realm object inside an IntentService?

I am getting the following Exception when I try to save a Realm object inside an IntentService. My guess is that the Service is killed before the Realm save actually happens, but I'm not sure how to fix this? 11-17 10:44:12.823…
Kamilski81
  • 14,409
  • 33
  • 108
  • 161
1
vote
2 answers

Show AlertDialog in IntentService

How to show AlertDialog in IntentService? Error looks like: Unable to add window -- token null is not for an application. So this is problem with context, but I don't know how to fix it. Any solutions? Below there is my code: public class…
1
vote
1 answer

Notification closed when Service finished

I'm creating a notification and updating it during the execution of an intent service. The problem appears when the services finished, also the notification is canceled. intentNotification = new Intent(this, ScanProcessActivity.class); …
MarcForn
  • 3,321
  • 7
  • 25
  • 39
1
vote
0 answers

Create and read a file in onHandleIntent in IntentService

Here is the code public class RSSReader extends IntentService{ protected void onHandleIntent(Intent intent) { try { File myFile = new File(Environment.getExternalStorageDirectory()+"rss.txt"); FileInputStream fIn = new…
Stacks13
  • 40
  • 5
1
vote
1 answer

Android overlapping views when using WindowManager

I'm using WindowManager to add views to the users screen using an IntentService, as shown here: WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, …
1
vote
1 answer

Quickblox create session being called through an intent service

I am trying to schedule an Alarm using AlarmManager which tries to recreate the QuickBlox session every two hours. I am calling an IntentService in the background via the AlarmManager. Following is the piece of code which crashes: protected void…
karan
  • 313
  • 2
  • 3
  • 20