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.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ClientResources(OkHttpClient session, SettingsParameters settingsParameters) Constructor to create an ClientResources Object.
      ClientResources() Constructor to create an ClientResources Object.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

      • ClientResources

        ClientResources(OkHttpClient session, SettingsParameters settingsParameters)
        Constructor to create an ClientResources Object.
        Parameters:
        session - a valid OKHttpClient instance
        settingsParameters - 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 result
        Example 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 resource
        callbackListener - and instance of { CallbackListener, } as callback handler
        Example 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 resource
        version - version of the resource
        callbackListener - and instance of { CallbackListener, } instance for the callback
        Example 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 written
        canOverwrite - boolean value to specify whether to overwrite the file or not
        callbackListener - and instance of { CallbackListener, } instance as the callback handler
        Example 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 resource
        version - version of the resource
        fileName - name of the target file to write to
        canOverwrite - should the existing file be overwritten or not
        callbackListener - and instance of { CallbackListener, } instance as the callback handler
        Example 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