Package zendesk.core

Interface SettingsProvider



  • public interface SettingsProvider

    A provider which will offer a higher level of abstraction compared to the SdkSettingsService
    This provider is used internally by the SDK and does not need to be called explicitly. If you do need to call it, create an instance of SettingsProvider like this:

          import zendesk.core.SettingsProvider;
          import zendesk.core.Zendesk;
          ...
          SettingsProvider provider = Zendesk.INSTANCE.provider().sdkSettingsProvider();
          ...
     

    Once you have an instance of the provider you can call methods on it and handle the results in callbacks. A success callback will give you the resource(s) that you are requesting. The error callback will be called if there was some issue with the method call and it will define details about the error in an com.zendesk.service.ErrorResponse

    For example you can get the SDK Settings like this:
       provider.getCoreSettings(new ZendeskCallback <CoreSettings>() {
            @Override
           public void onSuccess(CoreSettings settings) {
               // Handle the success
           }
    
            @Override
           public void onError(ErrorResponse errorResponse) {
               // Handle the error
           }
       });
     
    When you request SDK settings in this way the settings will be saved to the device also.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void getCoreSettings(<any> callback)
      Retrieves core settings from storage if they are valid or network if they are not.
      <E extends Settings>
      void
      getSettingsForSdk(java.lang.String key, java.lang.Class<E> sdkSettingsClass, <any> callback)
      Retrieves SDK-specific settings and Core settings in a SettingsPack object.
    • Method Detail

      • getCoreSettings

        void getCoreSettings(<any> callback)
        Retrieves core settings from storage if they are valid or network if they are not.
      • getSettingsForSdk

        <E extends Settings> void getSettingsForSdk(java.lang.String key,
                                                    java.lang.Class<E> sdkSettingsClass,
                                                    <any> callback)
        Retrieves SDK-specific settings and Core settings in a SettingsPack object. Checks storage first to see if it contains valid storage. If so, these are returned. Otherwise, they are retrieved from the network.
        Type Parameters:
        E - the expected type of the settings object
        Parameters:
        key - the request storage key
        sdkSettingsClass - a class instance describing the expected settings