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

application crashes during reaching database from a BroadCastReceiver in a service in xamarin android

Im using xamarin android to read my sms when it receives. Im using EFCore to use database in my app. for doing this i wrote a BroadCastReceiver and register it into a Service. when i comment the codes of EfCore application works perfectly but when i…
1
vote
1 answer

getWritableDatabase() instance throughout the application lifecycle

I have made Singelton object to make queries to SQLiteOpenHelper in which I have saved instance of getWriteableDatabase(). Throughout the application lifecycle, for all select and insert/update queries I am using that instance from multiple…
1
vote
0 answers

Android Intent Service Class cast exception while doing App upgrade

I have used an Intent service to schedule service calls for some interval. This service is also declared in Androidmanifest file. And then I have created a new Intent Service with different name. Then I commented out the Intentservice1 and declared…
fargath
  • 7,844
  • 6
  • 24
  • 36
1
vote
2 answers

Update progress of notification from a background service

I'm trying to update the progress of a notification during ftp upload handled by a background service, I tried directly from the service and after using a ResultReceiver but when the upload starts, the notification menu is freezed until the upload…
Roran
  • 433
  • 1
  • 5
  • 24
1
vote
1 answer

requestLocationUpdates five times started from IntentService

My control flow is in an IntentService (triggered by a GcmListenerService) and should now get the location of the user. As LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient) might return null, I should request some location…
1
vote
0 answers

Can a background android service be configured via GUI?

What I'm trying to do is have a background service running permanently after installing but supposing that the sensor is scheduled to work every 10 minutes, I want the user to have an interface which he can use to change the delay. So the service…
1
vote
0 answers

Create Background service that Update Locations based on User Activity

I am implementing a background service that updates the location based on the user's activity i.e if user is still it updates location after every 15 minutes and if user is moving it updates location after every 1 minute. I have created one…
1
vote
0 answers

IntentService unique and coupled to notification

My app is running an IntentService to download data in the background. While doing so, it sends Notifications to update the user about the progress. The problem is, if the BatterySafe mode gets started, the IntentService gets killed, the…
Luca Thiede
  • 3,229
  • 4
  • 21
  • 32
1
vote
1 answer

Android - When to use HandlerThread/Thread/ThreadPool/IntentService?

I know how to use each one of HandlerThread/Thread/ThreadPool/IntentService, But I'm really don't know which one I need to pick to use for background task. Somebody have some tips when to use each one?
1
vote
2 answers

Intent Service not working in doze mode

One of my peer developer has written an intent service that makes an API call and then sleeps for 2 mins. After waking up, it sends again. Below is the code: public class GpsTrackingService extends IntentService { .... @Override …
1
vote
1 answer

Android: IntentService starts but onHandleIntent is not executed

I want an IntentService to run every 10 seconds and put a simply debug line. This is my code: in the manifest: Creating the alarm manager to call the service every 10…
Amos
  • 1,321
  • 2
  • 23
  • 44
1
vote
0 answers

Is an IntentService suitable for Geofences

I am using the Android Developers sample app for geofencing as a basic for my own geofencing app. I have the impression that the geofences don't get trough a while after the application is killed. I noticed that this sample app uses an IntentService…
TomCB
  • 3,983
  • 9
  • 40
  • 66
1
vote
1 answer

Error while getting GCM token in client side

package nath.prem.com.premgcmproject; import android.content.Intent; import com.google.android.gms.iid.InstanceIDListenerService; /** * Created by prem on 22/7/16. */ public class GCMTokenRefreshListenerService extends InstanceIDListenerService…
prem nath
  • 75
  • 1
  • 12
1
vote
1 answer

intent service causes the App to crash

I used Android Service and I know how it works, but I do not know the difference between it and IntentService. So I created MyIntentService class as shown below, but at run time the App crashes and generate the below posted logCat errors. please…
1
vote
0 answers

Is RxAndroid could replace the role of IntentService?

Is RxAndroid could replace the role of IntentService ? I need to start from activity, but leaving activity the service continues its job. I steel need to continue interaction from background thread with UI thread ,(but not exactly for specified…
I.S.S.J
  • 153
  • 9