SyncRequest.Builder Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Builder class for a SyncRequest.
[Android.Runtime.Register("android/content/SyncRequest$Builder", DoNotGenerateAcw=true)]
public class SyncRequest.Builder : Java.Lang.Object
[<Android.Runtime.Register("android/content/SyncRequest$Builder", DoNotGenerateAcw=true)>]
type SyncRequest.Builder = class
inherit Object
- Inheritance
- Attributes
Remarks
Builder class for a SyncRequest. As you build your SyncRequest this class will also perform validation.
Java documentation for android.content.SyncRequest.Builder.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
| Name | Description |
|---|---|
| SyncRequest.Builder() |
Creates a builder for a synchronization request. |
| SyncRequest.Builder(IntPtr, JniHandleOwnership) |
Initializes a managed wrapper around an existing Java instance. |
Properties
| Name | Description |
|---|---|
| Class |
Returns the runtime class of this |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState | (Inherited from JavaObject) |
| JniPeerMembers |
Gets the JNI metadata used to invoke members of this Java peer. |
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| ThresholdClass |
Gets the JNI class used as the dispatch threshold for this Java peer. |
| ThresholdType |
Gets the JNI type used as the dispatch threshold for this Java peer. |
Methods
| Name | Description |
|---|---|
| Build() |
Performs validation over the request and throws the runtime exception
|
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Construct(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DisposeUnlessReferenced() | (Inherited from JavaObject) |
| Equals(Object) | (Inherited from JavaObject) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
| Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
| NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
| SetDisallowMetered(Boolean) |
Sets whether this transfer is disallowed on metered networks. Throws an IllegalArgumentException if |
| SetExpedited(Boolean) |
An expedited sync runs immediately and can preempt other non-expedited running syncs. Not valid for periodic sync and will throw an IllegalArgumentException in build() . |
| SetExtras(Bundle) |
Developer-provided extras handed back when sync actually occurs. This bundle is copied into the SyncRequest returned by build() . Example: String[] syncItems = {"dog", "cat", "frog", "child"}; SyncRequest.Builder builder = new SyncRequest.Builder() .setSyncAdapter(dummyAccount, dummyProvider) .syncOnce(); for (String syncData : syncItems) { Bundle extras = new Bundle(); extras.setString("data", syncData); builder.setExtras(extras); ContentResolver.sync(builder.build()); // Each sync() request creates a unique sync. } Only values of the following types may be used in the extras bundle: Integer Long Boolean Float Double String Account null If any data is present in the bundle not of this type, build() will throw a runtime exception. |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| SetIgnoreBackoff(Boolean) |
Convenience function for setting ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF . Ignoring back-off will force the sync scheduling process to ignore any back-off that was the result of a failed sync, as well as to invalidate any SyncResult.delayUntil value that may have been set by the adapter. Successive failures will not honor this flag. Not valid for periodic sync and will throw an IllegalArgumentException in build() . |
| SetIgnoreSettings(Boolean) |
Convenience function for setting ContentResolver.SYNC_EXTRAS_IGNORE_SETTINGS . Not valid for periodic sync and will throw an IllegalArgumentException in build() . Throws IllegalArgumentException if called and setDisallowMetered(boolean) has been set. |
| SetManual(Boolean) |
Convenience function for setting ContentResolver.SYNC_EXTRAS_MANUAL . Not valid for periodic sync and will throw an IllegalArgumentException in build() . |
| SetNoRetry(Boolean) |
Convenience function for setting ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY . A one-off sync operation that fails will be retried with exponential back-off unless this is set to true. Not valid for periodic sync and will throw an IllegalArgumentException in build(). |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| SetRequiresCharging(Boolean) |
Specify whether the sync requires the phone to be plugged in. |
| SetScheduleAsExpeditedJob(Boolean) |
Convenience function for setting ContentResolver.SYNC_EXTRAS_SCHEDULE_AS_EXPEDITED_JOB . Not to be confused with ContentResolver.SYNC_EXTRAS_EXPEDITED . Not valid for periodic syncs, expedited syncs, and syncs that require charging - an IllegalArgumentException will be thrown in build() . Parameters scheduleAsExpeditedJob boolean : whether to schedule as an expedited job. Default false. |
| SetSyncAdapter(Account, String) |
Specify an authority and account for this transfer. |
| SyncOnce() |
Request that a sync occur immediately. Example SyncRequest.Builder builder = (new SyncRequest.Builder()).syncOnce(); |
| SyncPeriodic(Int64, Int64) |
Build a periodic sync. Either this or syncOnce() must be called for this builder. Syncs are identified by target android.provider and by the contents of the extras bundle. You cannot reuse the same builder for one-time syncs after having specified a periodic sync (by calling this function). If you do, an IllegalArgumentException will be thrown. The bundle for a periodic sync can be queried by applications with the correct permissions using ContentResolver.getPeriodicSyncs(Account,String) , so no sensitive data should be transferred here. Example usage. Request a periodic sync every 5 hours with 20 minutes of flex. SyncRequest.Builder builder = (new SyncRequest.Builder()).syncPeriodic(5 * HOUR_IN_SECS, 20 * MIN_IN_SECS); Schedule a periodic sync every hour at any point in time during that hour. SyncRequest.Builder builder = (new SyncRequest.Builder()).syncPeriodic(1 * HOUR_IN_SECS, 1 * HOUR_IN_SECS); N.B.: Periodic syncs are not allowed to have any of ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY , ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF , ContentResolver.SYNC_EXTRAS_IGNORE_SETTINGS , ContentResolver.SYNC_EXTRAS_INITIALIZE , ContentResolver.SYNC_EXTRAS_FORCE , ContentResolver.SYNC_EXTRAS_EXPEDITED , ContentResolver.SYNC_EXTRAS_MANUAL , ContentResolver.SYNC_EXTRAS_SCHEDULE_AS_EXPEDITED_JOB set to true. If any are supplied then an IllegalArgumentException will be thrown. |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
| Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IJavaPeerable.Disposed() | (Inherited from JavaObject) |
| IJavaPeerable.Finalized() | (Inherited from JavaObject) |
| IJavaPeerable.JniObjectReferenceControlBlock | (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from JavaObject) |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |