# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Inherited Constants | Fields | Ctors | Methods | Inherited Methods

# SyncResult

`public final class SyncResult`
`extends Object` `implements Parcelable`

java.lang.Object
↳ | android.content.SyncResult

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 `android.os.Parcelable`
`int` | `CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` | `PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `writeToParcel(Parcel, int)`: 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 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 Creator<SyncResult>` | `CREATOR`
`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.
`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.
`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.
`public boolean` | `moreRecordsToGet` This field is ignored by the SyncManager.
`public boolean` | `partialSyncUnavailable` This field is ignored by the SyncManager.
`public final SyncStats` | `stats` Used to hold extras statistics about the sync operation.
`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.
`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).
`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).

### Public constructors
`SyncResult()` Create a "clean" SyncResult.

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

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `android.os.Parcelable`
`abstract int` | `describeContents()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
`abstract void` | `writeToParcel(Parcel dest, int flags)` Flatten this object in to a Parcel.

## Fields

### ALREADY_IN_PROGRESS

    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.

### CREATOR

    public static final Creator<SyncResult> CREATOR

### databaseError

    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.

### delayUntil

    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 `delayUntil` -- i.e. if the system back-off time is larger than `delayUntil`, `delayUntil` will essentially be ignored.

### fullSyncRequested

    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.

### moreRecordsToGet

    public boolean moreRecordsToGet

This field is ignored by the SyncManager.

### partialSyncUnavailable

    public boolean partialSyncUnavailable

This field is ignored by the SyncManager.

### stats

    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.

### syncAlreadyInProgress

    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.

### tooManyDeletions

    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 `ContentResolver#SYNC_EXTRAS_OVERRIDE_TOO_MANY_DELETIONS` or `ContentResolver#SYNC_EXTRAS_DISCARD_LOCAL_DELETIONS` set in the extras. It is then up to the SyncAdapter to decide how to honor that request.

### tooManyRetries

    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.

## Public constructors

### SyncResult

    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 `ContentResolver#SYNC_EXTRAS_UPLOAD` request, in which the request is retryed without the `ContentResolver#SYNC_EXTRAS_UPLOAD` extra set). The SyncManager checks the type of error by calling `SyncResult#hasHardError()` and `SyncResult#hasSoftError()`. If both are true then the SyncManager treats it as a hard error, not a soft error.

## Public methods

### clear

    public void clear ()

Clears the SyncResult to a clean state. Throws an `UnsupportedOperationException` if this is called when `syncAlreadyInProgress` is set.

### describeContents

    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 `writeToParcel(android.os.Parcel, int)`, the return value of this method must include the `CONTENTS_FILE_DESCRIPTOR` bit.

Returns
`int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or `CONTENTS_FILE_DESCRIPTOR`

### hasError

    public boolean hasError ()

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

Returns
`boolean` | true if either a soft or hard error occurred

### hasHardError

    public boolean hasHardError ()

Convenience method for determining if the SyncResult indicates that a hard error occurred. See `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:

- `SyncStats#numParseExceptions` > 0
- `SyncStats#numConflictDetectedExceptions` > 0
- `SyncStats#numAuthExceptions` > 0
- `tooManyDeletions`
- `tooManyRetries`
- `databaseError`

  Returns
  `boolean` | true if a hard error is indicated

### hasSoftError

    public boolean hasSoftError ()

Convenience method for determining if the SyncResult indicates that a soft error occurred. See `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:

- `SyncStats#numIoExceptions` > 0
- `syncAlreadyInProgress`

Returns
`boolean` | true if a soft error is indicated

### madeSomeProgress

    public boolean madeSomeProgress ()

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

Returns
`boolean` | true if the SyncManager should reschedule this sync.

### toDebugString

    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

Returns
`String` | debugging string.

### toString

    public String toString ()

Returns a string representation of the object. In general, the `toString` method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The `toString` method for class `Object` returns a string consisting of the name of the class of which the object is an instance, the at-sign character ``@`', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

>      getClass().getName() + '@' + Integer.toHexString(hashCode())

Returns
`String` | a string representation of the object.

### writeToParcel

    public void writeToParcel (Parcel parcel,
                    int flags)

Flatten this object in to a Parcel.

Parameters
`parcel` | `Parcel`: The Parcel in which the object should be written.
`flags` | `int`: Additional flags about how the object should be written. May be 0 or `Parcelable.PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of `Parcelable.PARCELABLE_WRITE_RETURN_VALUE`, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*