Questions tagged [jobservice]

110 questions
4
votes
4 answers

JobIntentService not starting properly

In package com.example.project.packageA I have a class which extends the JobIntentService defines as follows: public class MyService extends JobIntentService { static final int JOB_ID = 1000; static final String TAG…
Ziva
  • 3,181
  • 15
  • 48
  • 80
4
votes
0 answers

Periodic JobService is running multiple times per period

I'm having some trouble with my JobService just running once per period. Here's the code of my simple and stupid JobService: public class UpdateInfoJobService extends JobService { public final static int UPDATE_TRACKING_INFO_JOB_ID = 741; …
user1903
  • 790
  • 1
  • 6
  • 10
4
votes
0 answers

PersistableBundle setBoolean showing Min API Wrong

In Android Studio, while using PersistableBundle for jobSchedular, In functions 'setBoolean', 'getBoolean', it is showing that minimum API required is API 22 but in Google Android Docs it shows that Min API is API 21. Can Anyone one tell me if i am…
4
votes
0 answers

Maintain Order of multiple JobServices scheduled through JobScheduler

When using JobScheduler to schedule JobServices, if you queue up multiple jobs how does the order of execution get decided? For instance if JobSerivces get scheduled 1, 2, 3 in that order with the same requirements, what is the logic behind the OS…
Le2e410
  • 323
  • 4
  • 18
4
votes
1 answer

What happens if I don't call jobFinished for a JobService?

Out of interest and to better understand error scenarios: I have a JobService. In onStartJob I return true to inform the JobManager that there's additional work. The Android documentation mentions that I need to call jobFinished to let JobManager…
fjc
  • 5,590
  • 17
  • 36
3
votes
0 answers

What happens to the scheduled jobs in which its class is deleted in the updated app version

Let's say I use a JobService on my current app version. Then in the next app version, I want to delete the JobService class because I no longer need it. Is is safe to do so or do I need to take a phased approach where I keep the JobService class and…
mgk
  • 31
  • 1
3
votes
2 answers

RoomDB in JobSchedulerService

I recently added JobScheduler to my app via a JobService. I use the JobService to sync with my database periodically in the background and update a local Room DB instance. However, I am seeing arbitrary crashes with the error: Process:…
kilokahn
  • 1,136
  • 2
  • 18
  • 38
3
votes
1 answer

OnTaskRemoved in Android O

In my android app, I have a Service that starts when the app goes in background. OnStartCommand begins long running task that analyzes and checks device and app status. Now, I am preparing the app for Android O. First issue that i faced is…
Dmitry Zinoviev
  • 588
  • 1
  • 6
  • 20
3
votes
0 answers

Android JobScheduler delay in start or stop

I have created a JobScheduler to intimate user few features in my app based on date and time. But found out that the Job's are not scheduled at exact time which I am expecting to. Neither the job is getting stopped after the interval. As per my…
Sreehari
  • 5,621
  • 2
  • 25
  • 59
3
votes
0 answers

Using JobIntentService (different class, with shared JobId)

I wanna use JobIntentService for treating background works sequentially. Even though I define Background works as 2 different classes (A.java, B.java), I wanna these 2 classes works sequentially, So I decide to use same JobId for above 2…
david
  • 53
  • 1
  • 8
2
votes
1 answer

How to trigger background service when device theme is changed(Dark mode on or off) on Android

How to run background function when device theme is changed(Dark mode on or off) on Android. Is there any onThemeChangeListener(OnDarkModeOn) or IntentFilter or BroadcastReceiver for it?
2
votes
1 answer

Detect Connectivity Change When App is Killed/In Background

I'd like to detect when there is a network change (connection\disconnection) when my app is not in the foreground, so I can sync the user's data. I have tried to use a broadcast receiver (like in this answer) but the broadcasts are no longer…
Tal Barda
  • 4,067
  • 10
  • 28
  • 53
2
votes
0 answers

What is the point of setting setInterruptIfStopped to true in a JobIntentService?

JobIntentService has the setInterruptIfStopped method which, when set to true, causes the currently running AsyncTask to cancel if the job is stopped: void setInterruptIfStopped (boolean interruptIfStopped) Control whether code executing in…
2
votes
2 answers

Dagger2: how to resolve a JobService?

I'm trying to update my simple android app to use Dagger2. I think I've managed to understand some of the basics and the basic stuff (activities, view models, helpers) are being created through it. Now, there's still a small gotcha: the app has a…
Luis Abreu
  • 4,008
  • 9
  • 34
  • 63
2
votes
1 answer

How to use JobScheduler to replace custom Broadcast Receiver?

I have to listen a custom broadcast receiver that has registered in a AndroidManifest.xml, but now it doesn't work in Android O. I was given an advise that use JobScheduler API to solve this problem. I have looked at many docs and blogs, they just…