Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/app/job/JobServiceEngine#pubctors) \| [Methods](https://developer.android.com/reference/android/app/job/JobServiceEngine#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/job/JobServiceEngine#inhmethods)

# JobServiceEngine

*** ** * ** ***

` public abstract class JobServiceEngine `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.job.JobServiceEngine |

<br />

*** ** * ** ***

Helper for implementing a `https://developer.android.com/reference/android/app/Service` that interacts with `https://developer.android.com/reference/android/app/job/JobScheduler`. This is not intended for use by regular applications, but allows frameworks built on top of the platform to create their own `https://developer.android.com/reference/android/app/Service` that interact with `https://developer.android.com/reference/android/app/job/JobScheduler` as well as add in additional functionality. If you just want to execute jobs normally, you should instead be looking at `https://developer.android.com/reference/android/app/job/JobService`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/job/JobServiceEngine#JobServiceEngine(android.app.Service)(https://developer.android.com/reference/android/app/Service service) ` Create a new engine, ready for use. |

| ### Public methods ||
|---|---|
| ` final https://developer.android.com/reference/android/os/IBinder` | ` https://developer.android.com/reference/android/app/job/JobServiceEngine#getBinder()() ` Retrieve the engine's IPC interface that should be returned by `https://developer.android.com/reference/android/app/Service#onBind(android.content.Intent)`. |
| ` void` | ` https://developer.android.com/reference/android/app/job/JobServiceEngine#jobFinished(android.app.job.JobParameters,%20boolean)(https://developer.android.com/reference/android/app/job/JobParameters params, boolean needsReschedule) ` Call in to engine to report that a job has finished executing. |
| ` void` | ` https://developer.android.com/reference/android/app/job/JobServiceEngine#onNetworkChanged(android.app.job.JobParameters)(https://developer.android.com/reference/android/app/job/JobParameters params) ` Engine's report that the network for the job has changed. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/app/job/JobServiceEngine#onStartJob(android.app.job.JobParameters)(https://developer.android.com/reference/android/app/job/JobParameters params) ` Engine's report that a job has started. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/app/job/JobServiceEngine#onStopJob(android.app.job.JobParameters)(https://developer.android.com/reference/android/app/job/JobParameters params) ` Engine's report that a job has stopped. |
| ` void` | ` https://developer.android.com/reference/android/app/job/JobServiceEngine#setNotification(android.app.job.JobParameters,%20int,%20android.app.Notification,%20int)(https://developer.android.com/reference/android/app/job/JobParameters params, int notificationId, https://developer.android.com/reference/android/app/Notification notification, int jobEndNotificationPolicy) ` Give JobScheduler a notification to tie to this job's lifecycle. |
| ` void` | ` https://developer.android.com/reference/android/app/job/JobServiceEngine#updateEstimatedNetworkBytes(android.app.job.JobParameters,%20android.app.job.JobWorkItem,%20long,%20long)(https://developer.android.com/reference/android/app/job/JobParameters params, https://developer.android.com/reference/android/app/job/JobWorkItem item, long downloadBytes, long uploadBytes) ` Call in to engine to report data transfer progress. |
| ` void` | ` https://developer.android.com/reference/android/app/job/JobServiceEngine#updateTransferredNetworkBytes(android.app.job.JobParameters,%20android.app.job.JobWorkItem,%20long,%20long)(https://developer.android.com/reference/android/app/job/JobParameters params, https://developer.android.com/reference/android/app/job/JobWorkItem item, long downloadBytes, long uploadBytes) ` Call in to engine to report data transfer progress. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### JobServiceEngine

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public JobServiceEngine (Service service)
```

Create a new engine, ready for use.

<br />

| Parameters ||
|---|---|
| `service` | `Service`: The `https://developer.android.com/reference/android/app/Service` that is creating this engine and in which it will run. <br /> |

## Public methods

### getBinder

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final IBinder getBinder ()
```

Retrieve the engine's IPC interface that should be returned by `https://developer.android.com/reference/android/app/Service#onBind(android.content.Intent)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/IBinder` | <br /> |

### jobFinished

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void jobFinished (JobParameters params, 
                boolean needsReschedule)
```

Call in to engine to report that a job has finished executing. See `https://developer.android.com/reference/android/app/job/JobService#jobFinished(android.app.job.JobParameters,%20boolean)` for more information.

<br />

| Parameters ||
|---|---|
| `params` | `JobParameters` <br /> |
| `needsReschedule` | `boolean` <br /> |

### onNetworkChanged

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onNetworkChanged (JobParameters params)
```

Engine's report that the network for the job has changed.

<br />

| Parameters ||
|---|---|
| `params` | `JobParameters`: This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobService#onNetworkChanged(android.app.job.JobParameters)`

### onStartJob

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean onStartJob (JobParameters params)
```

Engine's report that a job has started. See `https://developer.android.com/reference/android/app/job/JobService#onStartJob(android.app.job.JobParameters)` for more information.

<br />

| Parameters ||
|---|---|
| `params` | `JobParameters` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### onStopJob

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean onStopJob (JobParameters params)
```

Engine's report that a job has stopped. See `https://developer.android.com/reference/android/app/job/JobService#onStopJob(android.app.job.JobParameters)` for more information.

<br />

| Parameters ||
|---|---|
| `params` | `JobParameters` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### setNotification

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setNotification (JobParameters params, 
                int notificationId, 
                Notification notification, 
                int jobEndNotificationPolicy)
```

Give JobScheduler a notification to tie to this job's lifecycle.

<br />

| Parameters ||
|---|---|
| `params` | `JobParameters`: This value cannot be `null`. <br /> |
| `notificationId` | `int` <br /> |
| `notification` | `Notification`: This value cannot be `null`. <br /> |
| `jobEndNotificationPolicy` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/app/job/JobService#JOB_END_NOTIFICATION_POLICY_DETACH` - `https://developer.android.com/reference/android/app/job/JobService#JOB_END_NOTIFICATION_POLICY_REMOVE` |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobService#setNotification(android.app.job.JobParameters,%20int,%20android.app.Notification,%20int)`

### updateEstimatedNetworkBytes

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void updateEstimatedNetworkBytes (JobParameters params, 
                JobWorkItem item, 
                long downloadBytes, 
                long uploadBytes)
```

Call in to engine to report data transfer progress.

<br />

| Parameters ||
|---|---|
| `params` | `JobParameters`: This value cannot be `null`. <br /> |
| `item` | `JobWorkItem`: This value may be `null`. <br /> |
| `downloadBytes` | `long`: Value is a non-negative number of bytes. <br /> |
| `uploadBytes` | `long`: Value is a non-negative number of bytes. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobService#updateEstimatedNetworkBytes(android.app.job.JobParameters,%20long,%20long)`
- `https://developer.android.com/reference/android/app/job/JobService#updateEstimatedNetworkBytes(android.app.job.JobParameters,%20android.app.job.JobWorkItem,%20long,%20long)`

### updateTransferredNetworkBytes

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void updateTransferredNetworkBytes (JobParameters params, 
                JobWorkItem item, 
                long downloadBytes, 
                long uploadBytes)
```

Call in to engine to report data transfer progress.

<br />

| Parameters ||
|---|---|
| `params` | `JobParameters`: This value cannot be `null`. <br /> |
| `item` | `JobWorkItem`: This value may be `null`. <br /> |
| `downloadBytes` | `long`: Value is a non-negative number of bytes. <br /> |
| `uploadBytes` | `long`: Value is a non-negative number of bytes. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobService#updateTransferredNetworkBytes(android.app.job.JobParameters,%20long,%20long)`
- `https://developer.android.com/reference/android/app/job/JobService#updateTransferredNetworkBytes(android.app.job.JobParameters,%20android.app.job.JobWorkItem,%20long,%20long)`