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
1 answer

IntentService with AlarmManager

I want to re-start my IntentService (which handles HTTP POST request) every 10 seconds. I tried using AlarmManager and PendingIntent as descrribed in every posts. But my IntentService doesn't starts. I'm unable to find any reason for this so any…
1
vote
0 answers

How to trigger force download from content provider while using LoaderCallbacks in Android

I'm implementing the Content Provider API from Virgil Dobjanschi by making the requests from the Content Provider. I've looked here for instructions. In the presentation it says that you can send a flag (force download) through the URI and while…
1
vote
1 answer

Using Parse.com in Android Intent Service

I want to upload some data to my database on Parse.com from a background service on Android. I have used Parse in Activities before and used to write the following lines in its onCreate() method: Parse.enableLocalDatastore(this); …
1
vote
2 answers

How to check if App.onCreate() was called via a push notification or during app open by an user

I have an App extends Application class that has an onCreate() function that is executed at the start of the Android application This gets fired when the user opens the app, and also when a push notification is received. The push notification code…
1
vote
1 answer

In Android when collecting data using a sensor should I use IntentService or Service?

I'm making an app that will collect data using a sensor, only when the device is on. This program will mainly run from the notification bar. Most of the posts about using sensors in the background seem to suggest using Service but I've read that…
1
vote
2 answers

IntentService onHandleIntent behaviour on device shutdown

What would be the behaviour of onHandleIntent on device shutdown? I know on IntentService, the service keeps running as long as onHandleIntent didn't finish its job. so coming to think about it its a general question about services behaviour on…
1
vote
1 answer

IntentService's own Thread

I know an IntentService itself runs on a different thread. Also that it execute the onHandleIntent() and stops when that method is done. my question is: are there any consequences for creating my own custom Thread inside the intent service? I know…
sharon gur
  • 343
  • 5
  • 22
1
vote
0 answers

Android: Creating service on different process, that registers receiver that starts intentservice

I'm building an application that one of the things it does is listening to several android broadcasts on the phone (like ringermodechanged etc.. ) and sends them to a server. The part that does this thing is crucial to the application, and I need…
1
vote
1 answer

Use service or intent service?

I don't know which of these methods are suited for my needs. I need to add a background service to my application that Opens a server socket Wait for a socket connection from a client Once socket connection is made, indefinitely listen for messages…
1
vote
2 answers

Interaction between IntentService and Activity - Android

In my application I am using an IntentService to download a file from a cloud. And showing the progress in NotificationManager. I need to show the status (Downloading/Completed or Failed) in the Activity which stared the IntentService too. My…
Sniper
  • 2,412
  • 11
  • 44
  • 49
1
vote
0 answers

Android INSTALL_SHORTCUT async

I am using the following method: private void placeShortcutIcon(){ Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + mAppData.packageName)); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); …
JY2k
  • 2,879
  • 1
  • 31
  • 60
1
vote
1 answer

Will intentService result in concurrecny issue with the activity

I have read that IntentService create worker thread for the work to be done. If I understand correctly, then that means that the work will be done on a thread other than the UI thread. My question is if my activity is trying to update shared…
Snake
  • 14,228
  • 27
  • 117
  • 250
1
vote
1 answer

Send data to mainactivity from separate intent

Intent goMain = new Intent(getBaseContext(),MainActivity.class); goMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |…
gokturk
  • 116
  • 2
  • 13
1
vote
2 answers

How to run an Android service in Background after it is swiped out by Recent activity?

I have a background service that should always run. It should wait for in-coming e-mails, when an e-mail arrives(to my old phone), it will trigger an action. (to send an sms to my new phone). Not a clever user-case but just learning…
Android_Noob
  • 487
  • 2
  • 6
  • 19
1
vote
1 answer

Send Update to Repeating BroadcastReceiver

I have something like the following for initiating an IntentService via repeated calls to a BroadcastReceiver to poll for server updates: AlarmManager pollManager; Intent pollIntent; PendingIntent pollPendingIntent; ... pollIntent = new…