java.lang.Object | ||
↳ | java.lang.Enum<E extends java.lang.Enum<E>> | |
↳ | com.kinvey.java.offline.OfflinePolicy |
This enum set determines behaivor of an Offline Request
Enum Values | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
OfflinePolicy | ALWAYS_ONLINE | This policy will not use any local storage or queueing, and will execute every request online. | |||||||||
OfflinePolicy | LOCAL_FIRST | This policy will attempt to execute the request against the local store first. | |||||||||
OfflinePolicy | ONLINE_FIRST | This policy will attempt to execute the request online first, and if that is successful will update the local store with the results. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract <T> T | execute(AbstractKinveyOfflineClientRequest<T> offlineRequest) | ||||||||||
static OfflinePolicy | valueOf(String name) | ||||||||||
final static OfflinePolicy[] | values() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
This policy will not use any local storage or queueing, and will execute every request online.
If no network connection is available, errors will be returned through the onFailure callback.
Use this policy if your application is fully dependant on data in the backend, and data cannot be stored locally.
This policy will attempt to execute the request against the local store first.
If the request is a Get, and the data cannot be found in the local store, then an online request will be attempted. If that suceeds, the store will be updated, and onSuccess will be called. If that fials, then onFailure will be called. For save requests, the local store will be updated and the entity will be returned through the onSuccess callback.
Use this policy if each user has their own data, and updates are not constantly from your backend.
This policy will attempt to execute the request online first, and if that is successful will update the local store with the results.
If the request fails due to connectivity issues, then the request will be executed against the local store. If it fails for any other reason such as an Authorization Error, the onFailure callback will be called.
Use this policy if your application's data is constantly changing on the backend, but you want to support offline mode.