Package com.cloudinary.android.policy
Class UploadPolicy
java.lang.Object
com.cloudinary.android.policy.UploadPolicy
- Direct Known Subclasses:
GlobalUploadPolicy
public class UploadPolicy
extends java.lang.Object
Represents the set of conditions that must be met for a request to execute. Note: A request will be executed regardless of policy once the
TimeWindow expires.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUploadPolicy.BackoffPolicyEnum to define the backoff policy for request rescheduling.static classUploadPolicy.BuilderA utility class to construct an instance ofUploadPolicy.static classUploadPolicy.NetworkTypeEnum to define requirements for network. -
Constructor Summary
Constructors Modifier Constructor Description protectedUploadPolicy(UploadPolicy.NetworkType networkType, boolean requiresCharging, boolean requiresIdle, int maxErrorRetries, long backoffMillis, UploadPolicy.BackoffPolicy backoffPolicy)UseUploadPolicy.Builderto configure and get an instance ofUploadPolicy. -
Method Summary
Modifier and Type Method Description static UploadPolicydefaultPolicy()longgetBackoffMillis()UploadPolicy.BackoffPolicygetBackoffPolicy()intgetMaxErrorRetries()Maximum retries before failing the request permanently.UploadPolicy.NetworkTypegetNetworkType()UploadPolicy.NetworkTyperequired to execute the request.booleanhasRequirements()booleanisRequiresCharging()Whether charging is required to execute the request.booleanisRequiresIdle()Whether the phone needs to be idle to execute the request.UploadPolicy.BuildernewBuilder()Get a new builder with the configuration copied from this policy.
-
Constructor Details
-
UploadPolicy
protected UploadPolicy(UploadPolicy.NetworkType networkType, boolean requiresCharging, boolean requiresIdle, int maxErrorRetries, long backoffMillis, UploadPolicy.BackoffPolicy backoffPolicy)UseUploadPolicy.Builderto configure and get an instance ofUploadPolicy.
-
-
Method Details
-
defaultPolicy
- Returns:
- An instance of
UploadPolicyget the default configuration.
-
getNetworkType
UploadPolicy.NetworkTyperequired to execute the request. -
isRequiresCharging
public boolean isRequiresCharging()Whether charging is required to execute the request. -
isRequiresIdle
public boolean isRequiresIdle()Whether the phone needs to be idle to execute the request. -
getMaxErrorRetries
public int getMaxErrorRetries()Maximum retries before failing the request permanently. -
getBackoffPolicy
-
getBackoffMillis
public long getBackoffMillis() -
hasRequirements
public boolean hasRequirements() -
newBuilder
Get a new builder with the configuration copied from this policy.
-