Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/content/SyncResult#inhconstants) \| [Fields](https://developer.android.com/reference/android/content/SyncResult#lfields) \| [Ctors](https://developer.android.com/reference/android/content/SyncResult#pubctors) \| [Methods](https://developer.android.com/reference/android/content/SyncResult#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/content/SyncResult#inhmethods)

# SyncResult

*** ** * ** ***

` public final class SyncResult `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.SyncResult |

<br />

*** ** * ** ***

This class is used to communicate the results of a sync operation to the SyncManager. Based on the values here the SyncManager will determine the disposition of the sync and whether or not a new sync operation needs to be scheduled in the future.

## Summary

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/content/SyncResult` | `https://developer.android.com/reference/android/content/SyncResult#ALREADY_IN_PROGRESS` This instance of a SyncResult is returned by the SyncAdapter in response to a sync request when a sync is already underway. |
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/content/SyncResult>` | `https://developer.android.com/reference/android/content/SyncResult#CREATOR` <br /> |
| ` public boolean` | `https://developer.android.com/reference/android/content/SyncResult#databaseError` Used to indicate that the SyncAdapter experienced a hard error due to an error it received from interacting with the storage layer. |
| ` public long` | `https://developer.android.com/reference/android/content/SyncResult#delayUntil` Used to indicate to the SyncManager that future sync requests that match the request's Account and authority should be delayed until a time in seconds since Java epoch. |
| ` public boolean` | `https://developer.android.com/reference/android/content/SyncResult#fullSyncRequested` If set the SyncManager will request an immediate sync with the same Account and authority (but empty extras Bundle) as was used in the sync request. |
| ` public boolean` | `https://developer.android.com/reference/android/content/SyncResult#moreRecordsToGet` This field is ignored by the SyncManager. |
| ` public boolean` | `https://developer.android.com/reference/android/content/SyncResult#partialSyncUnavailable` This field is ignored by the SyncManager. |
| ` public final https://developer.android.com/reference/android/content/SyncStats` | `https://developer.android.com/reference/android/content/SyncResult#stats` Used to hold extras statistics about the sync operation. |
| ` public final boolean` | `https://developer.android.com/reference/android/content/SyncResult#syncAlreadyInProgress` Used to indicate that the SyncAdapter is already performing a sync operation, though not necessarily for the requested account and authority and that it wasn't able to process this request. |
| ` public boolean` | `https://developer.android.com/reference/android/content/SyncResult#tooManyDeletions` Used to indicate that the SyncAdapter determined that it would need to issue too many delete operations to the server in order to satisfy the request (as defined by the SyncAdapter). |
| ` public boolean` | `https://developer.android.com/reference/android/content/SyncResult#tooManyRetries` Used to indicate that the SyncAdapter experienced a hard error due to trying the same operation too many times (as defined by the SyncAdapter). |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/content/SyncResult#SyncResult()() ` Create a "clean" SyncResult. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/content/SyncResult#clear()() ` Clears the SyncResult to a clean state. |
| ` int` | ` https://developer.android.com/reference/android/content/SyncResult#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/content/SyncResult#hasError()() ` A convenience method for determining of the SyncResult indicates that an error occurred. |
| ` boolean` | ` https://developer.android.com/reference/android/content/SyncResult#hasHardError()() ` Convenience method for determining if the SyncResult indicates that a hard error occurred. |
| ` boolean` | ` https://developer.android.com/reference/android/content/SyncResult#hasSoftError()() ` Convenience method for determining if the SyncResult indicates that a soft error occurred. |
| ` boolean` | ` https://developer.android.com/reference/android/content/SyncResult#madeSomeProgress()() ` Convenience method for determining if the Sync should be rescheduled after failing for some reason. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/content/SyncResult#toDebugString()() ` Generates a debugging string indicating the status. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/content/SyncResult#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/content/SyncResult#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel parcel, int flags) ` Flatten this object in to a Parcel. |

### 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*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Fields

### ALREADY_IN_PROGRESS

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

```
public static final SyncResult ALREADY_IN_PROGRESS
```

This instance of a SyncResult is returned by the SyncAdapter in response to a sync request when a sync is already underway. The SyncManager will reschedule the sync request to try again later.

<br />

### CREATOR

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

```
public static final Creator<SyncResult> CREATOR
```

<br />

<br />

### databaseError

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

```
public boolean databaseError
```

Used to indicate that the SyncAdapter experienced a hard error due to an error it received from interacting with the storage layer. The SyncManager will record that the sync request failed and it will not reschedule the request.

<br />

### delayUntil

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

```
public long delayUntil
```

Used to indicate to the SyncManager that future sync requests that match the request's Account and authority should be delayed until a time in seconds since Java epoch.

For example, if you want to delay the next sync for at least 5 minutes, then:

```
result.delayUntil = (System.currentTimeMillis() / 1000) + 5 * 60;
```

By default, when a sync fails, the system retries later with an exponential back-off with the system default initial delay time, which always wins over `https://developer.android.com/reference/android/content/SyncResult#delayUntil` -- i.e. if the system back-off time is larger than `https://developer.android.com/reference/android/content/SyncResult#delayUntil`, `https://developer.android.com/reference/android/content/SyncResult#delayUntil` will essentially be ignored.

<br />

### fullSyncRequested

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

```
public boolean fullSyncRequested
```

If set the SyncManager will request an immediate sync with the same Account and authority (but empty extras Bundle) as was used in the sync request.

<br />

### moreRecordsToGet

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

```
public boolean moreRecordsToGet
```

This field is ignored by the SyncManager.

<br />

### partialSyncUnavailable

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

```
public boolean partialSyncUnavailable
```

This field is ignored by the SyncManager.

<br />

### stats

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

```
public final SyncStats stats
```

Used to hold extras statistics about the sync operation. Some of these indicate that the sync request resulted in a hard or soft error, others are for purely informational purposes.

<br />

### syncAlreadyInProgress

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

```
public final boolean syncAlreadyInProgress
```

Used to indicate that the SyncAdapter is already performing a sync operation, though not necessarily for the requested account and authority and that it wasn't able to process this request. The SyncManager will reschedule the request to run later.

<br />

### tooManyDeletions

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

```
public boolean tooManyDeletions
```

Used to indicate that the SyncAdapter determined that it would need to issue too many delete operations to the server in order to satisfy the request (as defined by the SyncAdapter). The SyncManager will record that the sync request failed and will cause a System Notification to be created asking the user what they want to do about this. It will give the user a chance to choose between (1) go ahead even with those deletes, (2) revert the deletes, or (3) take no action. If the user decides (1) or (2) the SyncManager will issue another sync request with either `https://developer.android.com/reference/android/content/ContentResolver#SYNC_EXTRAS_OVERRIDE_TOO_MANY_DELETIONS` or `https://developer.android.com/reference/android/content/ContentResolver#SYNC_EXTRAS_DISCARD_LOCAL_DELETIONS` set in the extras. It is then up to the SyncAdapter to decide how to honor that request.

<br />

### tooManyRetries

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

```
public boolean tooManyRetries
```

Used to indicate that the SyncAdapter experienced a hard error due to trying the same operation too many times (as defined by the SyncAdapter). The SyncManager will record that the sync request failed and it will not reschedule the request.

<br />

## Public constructors

### SyncResult

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

```
public SyncResult ()
```

Create a "clean" SyncResult. If this is returned without any changes then the SyncManager will consider the sync to have completed successfully. The various fields can be set by the SyncAdapter in order to give the SyncManager more information as to the disposition of the sync.

The errors are classified into two broad categories: hard errors and soft errors. Soft errors are retried with exponential backoff. Hard errors are not retried (except when the hard error is for a `https://developer.android.com/reference/android/content/ContentResolver#SYNC_EXTRAS_UPLOAD` request, in which the request is retryed without the `https://developer.android.com/reference/android/content/ContentResolver#SYNC_EXTRAS_UPLOAD` extra set). The SyncManager checks the type of error by calling `https://developer.android.com/reference/android/content/SyncResult#hasHardError()` and `https://developer.android.com/reference/android/content/SyncResult#hasSoftError()`. If both are true then the SyncManager treats it as a hard error, not a soft error.

<br />

## Public methods

### clear

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

```
public void clear ()
```

Clears the SyncResult to a clean state. Throws an `https://developer.android.com/reference/java/lang/UnsupportedOperationException` if this is called when `https://developer.android.com/reference/android/content/SyncResult#syncAlreadyInProgress` is set.

<br />

### describeContents

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

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`, the return value of this method must include the `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### hasError

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

```
public boolean hasError ()
```

A convenience method for determining of the SyncResult indicates that an error occurred.

<br />

| Returns ||
|---|---|
| `boolean` | true if either a soft or hard error occurred <br /> |

### hasHardError

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

```
public boolean hasHardError ()
```

Convenience method for determining if the SyncResult indicates that a hard error occurred. See `https://developer.android.com/reference/android/content/SyncResult#SyncResult()` for an explanation of what the SyncManager does when it sees a hard error.

A hard error is indicated when any of the following is true:

- `https://developer.android.com/reference/android/content/SyncStats#numParseExceptions` \> 0
- `https://developer.android.com/reference/android/content/SyncStats#numConflictDetectedExceptions` \> 0
- `https://developer.android.com/reference/android/content/SyncStats#numAuthExceptions` \> 0
- `https://developer.android.com/reference/android/content/SyncResult#tooManyDeletions`
- `https://developer.android.com/reference/android/content/SyncResult#tooManyRetries`
- `https://developer.android.com/reference/android/content/SyncResult#databaseError`

  <br />

  <br />

  | Returns ||
  |---|---|
  | `boolean` | true if a hard error is indicated <br /> |

### hasSoftError

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

```
public boolean hasSoftError ()
```

Convenience method for determining if the SyncResult indicates that a soft error occurred. See `https://developer.android.com/reference/android/content/SyncResult#SyncResult()` for an explanation of what the SyncManager does when it sees a soft error.

A soft error is indicated when any of the following is true:

- `https://developer.android.com/reference/android/content/SyncStats#numIoExceptions` \> 0
- `https://developer.android.com/reference/android/content/SyncResult#syncAlreadyInProgress`

<br />

<br />

| Returns ||
|---|---|
| `boolean` | true if a soft error is indicated <br /> |

### madeSomeProgress

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

```
public boolean madeSomeProgress ()
```

Convenience method for determining if the Sync should be rescheduled after failing for some reason.

<br />

| Returns ||
|---|---|
| `boolean` | true if the SyncManager should reschedule this sync. <br /> |

### toDebugString

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

```
public String toDebugString ()
```

Generates a debugging string indicating the status. The string consist of a sequence of code letter followed by the count. Code letters are f - fullSyncRequested, r - partialSyncUnavailable, X - hardError, e - numParseExceptions, c - numConflictDetectedExceptions, a - numAuthExceptions, D - tooManyDeletions, R - tooManyRetries, b - databaseError, x - softError, l - syncAlreadyInProgress, I - numIoExceptions

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | debugging string. <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel parcel, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `parcel` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |