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

Android : Not able to sync data between applications above Oreo + devices

I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you…
1
vote
0 answers

JobIntentService not Starting properly in Some Devices?

Previously am using IntentService to trigger the Background services with AlaramManager. Now am changed the IntentService to JobIntentService for trigger Background process to fetch the data from Server. In Some devices JobIntentService not…
Yugesh
  • 4,030
  • 9
  • 57
  • 97
1
vote
1 answer

Errors while adding the intent on Java part in an Android app

I am a beginner in coding. I am learning how to developpe Android apps on Android Studio, this is the java part. I am following a udacity corse step by step but i haven't known how to fix the error. Please can someone fix it for me and explain…
1
vote
1 answer

BroadcastReceiver not getting updated from ACTION_BATTERY_CHANGED

I've created custom broadcast receiver to listen for battery changes (I would like to monitor the percentage level of the battery) However I'm not getting any updates. Here is my setup: class MyService : IntentService("MyService") { val receiver:…
K.Os
  • 5,123
  • 8
  • 40
  • 95
1
vote
1 answer

Foreground(/Background) Service Or Geofencing API

I am working on an android app that has to update location every 10 seconds. Means I have to do polling for every 10 seconds when user wanted to do. Which one is better to use Service or Geofencing API. Which will be better for reducing battery…
1
vote
2 answers

Broadcast receiver IntentReceiverLeaked

I am trying to download a file and after download want to update it in the database, but in my intent the service broadcast receiver is creating this issue: android.app.IntentReceiverLeaked: Service…
1
vote
1 answer

IntentService for background location updates

I have a problem about using IntentService.If my app is in background or close i cant update my current location and cant get notification.If I open app again i get notification . So i cant get notification on time.I mean i dont have a problem…
1
vote
1 answer

Open File-Intent in all devices through the same code or by applying any logic

I want to choose a file via an Android File Manager. so, to open file intent code is Intent intent = new Intent(); intent.setType("file/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select…
1
vote
0 answers

IntentService scheduled by AlarmManager sometimes die

I have an app that every minute launches an IntentService that gets the UsageStats and UsageEvents on this period. I used setExact() method of AlarmManager to set the moment that the IntentService is executed and on the onCreate method of the…
1
vote
1 answer

inexplicable ANRs when executing service

I have an IntentService that I use to send logs to our logging server. I've received reports of this app in the field exiting with no reason, no ANR, no "unfortunately...", just a silent "crash to desktop" (It's not a "crash" - crashlytics doesn't…
rguessford
  • 370
  • 4
  • 10
1
vote
0 answers

BIND_JOB_SERVICE security exception even when service has android.permission.BIND_JOB_SERVICE

I have two applications I am building targeting Android 7.1 (running in emulator for this). App1 and App2 One of the apps contains a JobIntentService, which I have implemented overrides for onCreate and onhandleWork This service is declared in…
Derek
  • 11,715
  • 32
  • 127
  • 228
1
vote
2 answers

broadcast receiver not received in IntentService

I am building a service to be able to catch intent from FirebaseMessagingService. The first version I made use to do it at app level in the main activity but I do not want to handle it at this level anymore. I have created an intent service as…
1
vote
1 answer

Is the onCreate run on the main thread?

I understand that IntentServices allow running tasks on worker threads, however is the worker thread only spawn on call back to onHandleIntent? Is the onCreate() called on the main thread and any object creation that takes place in the onCreate…
1
vote
1 answer

Runtime.getRuntime().exec using PIPE in command

I'm trying to create a splitted TAR file and reading the progress by checking the size of the directory. (I cannot use PV command). Can someone explain me why if in tarService.java I change the command to: String cmd="su -c tar -cp -C /dev . | split…
1
vote
2 answers

Same Intent Service running multiple background tasks parallely (ISSUE)

public class DataManager extends IntentService { @Override public void onCreate() { super.onCreate(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { } @Nullable @Override …
Ankur
  • 677
  • 1
  • 7
  • 21