Class ClientResources
-
- All Implemented Interfaces:
@Deprecated() public class ClientResources
The ClientResources class that implements APIs to download client resources or retrieve information about resources from mobile services. It uses the mobile services client resources API. Deprecated since 3.2, replaced with ClientResourceService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
ClientResources.CallbackListener
Interface definition for callback handler for operation. Generic type T is the type of the data retrieved and provided as a parameter to the onSuccess method.
-
Constructor Summary
Constructors Constructor Description ClientResources(OkHttpClient session, SettingsParameters settingsParameters)
Constructor to create an ClientResources Object. ClientResources()
Constructor to create an ClientResources Object.
-
Method Summary
Modifier and Type Method Description void
downloadResource(@NonNull() ClientResources.CallbackListener<Array<byte>> callbackListener)
Downloads default resource. void
downloadResource(@NonNull() String resourceName, @NonNull() ClientResources.CallbackListener<Array<byte>> callbackListener)
Download a named resource. void
downloadResource(@NonNull() String resourceName, @NonNull() String version, @NonNull() ClientResources.CallbackListener<Array<byte>> callbackListener)
Download specific version of the named resource. void
downloadResource(@NonNull() String fileName, @NonNull() boolean canOverwrite, @NonNull() ClientResources.CallbackListener<Void> callbackListener)
Download the default resource and write the content to a file. void
downloadResource(@NonNull() String resourceName, @NonNull() String version, @NonNull() String fileName, boolean canOverwrite, @NonNull() ClientResources.CallbackListener callbackListener)
Download a specific version of a named resource and write the content to a file. void
fetchResourceInfo(@NonNull() ClientResources.CallbackListener<Array<ResourceBundle>> callbackListener)
This function fetches the list of resources available. -
-
Constructor Detail
-
ClientResources
ClientResources(OkHttpClient session, SettingsParameters settingsParameters)
Constructor to create an ClientResources Object.- Parameters:
session
- a valid OKHttpClient instancesettingsParameters
- an instance of SettingsParameters initialized
-
ClientResources
ClientResources()
Constructor to create an ClientResources Object.
-
-
Method Detail
-
downloadResource
void downloadResource(@NonNull() ClientResources.CallbackListener<Array<byte>> callbackListener)
Downloads default resource. The returned { CallbackListener, } instance can be used to set callback handler and access data. The callback will be executed only on UI thread.
- Parameters:
callbackListener
- an instance of { CallbackListener, } to process resultExample Usage:
ClientResources clientResources = new ClientResources(okHttpClient, settingsParameters);clientResources.downloadResource(new ClientResources.CallbackListener() { public void onSuccess(@NonNull byte[] byteData) { //Code to handle the read data } public void onError(@NonNull Throwable error) { //Code to handle error}});
-
downloadResource
void downloadResource(@NonNull() String resourceName, @NonNull() ClientResources.CallbackListener<Array<byte>> callbackListener)
Download a named resource. The callback handler methods will be called on a UI thread
- Parameters:
resourceName
- name of the resourcecallbackListener
- and instance of { CallbackListener, } as callback handlerExample Usage:
ClientResources clientResources = new ClientResources(okHttpClient, settingsParameters);clientResources.downloadResource("resourcename", new ClientResources.CallbackListener() { public void onSuccess(@NonNull byte[] byteData) { //Code to handle the read data } public void onError(@NonNull Throwable error) { //Code to handle error}});
-
downloadResource
void downloadResource(@NonNull() String resourceName, @NonNull() String version, @NonNull() ClientResources.CallbackListener<Array<byte>> callbackListener)
Download specific version of the named resource. The callback will be executed only on UI thread.
- Parameters:
resourceName
- name of the resourceversion
- version of the resourcecallbackListener
- and instance of { CallbackListener, } instance for the callbackExample Usage:
ClientResources clientResources = new ClientResources(okHttpClient, settingsParameters);clientResources.downloadResource("resourcename", "1.0", new ClientResources.CallbackListener() { public void onSuccess(@NonNull byte[] byteData) { //Code to handle the read data } public void onError(@NonNull Throwable error) { //Code to handle error}});
-
downloadResource
void downloadResource(@NonNull() String fileName, @NonNull() boolean canOverwrite, @NonNull() ClientResources.CallbackListener<Void> callbackListener)
Download the default resource and write the content to a file. The callback will be executed only on UI thread.
- Parameters:
fileName
- name of the destination file where the data to be writtencanOverwrite
- boolean value to specify whether to overwrite the file or notcallbackListener
- and instance of { CallbackListener, } instance as the callback handlerExample Usage:
ClientResources clientResources = new ClientResources(okHttpClient, settingsParameters);clientResources.downloadResource(fileLocation + "/filename.ext", true, new ClientResources.CallbackListener() { public void onSuccess(Void v) { //Handle success callback } public void onError(@NonNull Throwable error) { //Handle the error callback }});
-
downloadResource
void downloadResource(@NonNull() String resourceName, @NonNull() String version, @NonNull() String fileName, boolean canOverwrite, @NonNull() ClientResources.CallbackListener callbackListener)
Download a specific version of a named resource and write the content to a file. If the canOverwrite is true the existing file will be overwritten. The callback will be executed only on UI thread.
- Parameters:
resourceName
- name of the resourceversion
- version of the resourcefileName
- name of the target file to write tocanOverwrite
- should the existing file be overwritten or notcallbackListener
- and instance of { CallbackListener, } instance as the callback handlerExample Usage:
ClientResources clientResources = new ClientResources(okHttpClient, settingsParameters);clientResources.downloadResource("nameofresource", "1.0", fileLocation + "/filename.ext", true, new ClientResources.CallbackListener() { public void onSuccess(Void v) { //Handle success callback } public void onError(@NonNull Throwable error) { //Handle the error callback }});
-
fetchResourceInfo
void fetchResourceInfo(@NonNull() ClientResources.CallbackListener<Array<ResourceBundle>> callbackListener)
This function fetches the list of resources available. The callback will be executed only on UI thread.
- Parameters:
callbackListener
- and instance of { CallbackListener, } instance as the callback handler
-
-
-
-