Interface PushRegistrationProvider



  • public interface PushRegistrationProvider

    A provider which will offer a higher level of abstraction compared to the PushRegistrationService
    You can create an instance of PushRegistrationProvider like this:

          import com.zendesk.sdk.network.PushRegistrationProvider;
          import com.zendesk.sdk.network.impl.ZendeskConfig;
          ...
          PushRegistrationProvider provider = ZendeskConfig.INSTANCE.provider().pushRegistrationProvider();
          ...
     

    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, like the result of registering for and un-registering from push. 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 ErrorResponse

    For example you can register the device for push notifications like this:

       provider.registerDeviceWithIdentifier("push-token", Locale.getDefault(),  new ZendeskCallback<PushRegistrationResponse>() {
            @Override
           public void onSuccess(PushRegistrationResponse pushRegistrationResponse) {
               // Handle success
           }
    
            @Override
           public void onError(ErrorResponse errorResponse) {
               // Handle error
           }
      });
     
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void registerDeviceWithIdentifier(java.lang.String identifier, java.util.Locale locale, <any> callback)
      Calls a push registration service to register a given identifier to receive push notifications.
      void registerDeviceWithUAChannelId(java.lang.String urbanAirshipChannelId, java.util.Locale locale, <any> callback)
      Calls a push registration service to register a given Urban Airship channel id to receive push notifications.
      void unregisterDevice(java.lang.String identifier, <any> callback)
      Calls a push registration service to unregister a device to receive push notifications.
    • Method Detail

      • registerDeviceWithIdentifier

        void registerDeviceWithIdentifier(java.lang.String identifier,
                                          java.util.Locale locale,
                                          <any> callback)
        Calls a push registration service to register a given identifier to receive push notifications.

        This method stores the PushRegistrationResponse to disk on successful registration. Subsequent calls to this method with the same identifier will return early, passing the stored PushRegistrationResponse to ZendeskCallback#onSuccess(Object), and will not make any calls to the network.

        Calling this method with a different identifier will remove any stored PushRegistrationResponse from storage.

        Parameters:
        identifier - The device identifier
        locale - The preferred device locale
        callback - Callback that will deliver a newly created device configuration PushRegistrationResponse or ErrorResponse
        Since:
        1.4.0.1
      • registerDeviceWithUAChannelId

        void registerDeviceWithUAChannelId(java.lang.String urbanAirshipChannelId,
                                           java.util.Locale locale,
                                           <any> callback)
        Calls a push registration service to register a given Urban Airship channel id to receive push notifications.

        This method stores the PushRegistrationResponse to disk on successful registration. Subsequent calls to this method with the same identifier will return early, passing the stored PushRegistrationResponse to ZendeskCallback#onSuccess(Object), and will not make any calls to the network.

        Calling this method with a different identifier will remove any stored PushRegistrationResponse from storage.

        Parameters:
        urbanAirshipChannelId - The UrbanAirship channel identifier
        locale - The preferred device locale
        callback - Callback that will deliver a newly created device configuration PushRegistrationResponse or ErrorResponse
        Since:
        1.4.0.1
      • unregisterDevice

        void unregisterDevice(java.lang.String identifier,
                              <any> callback)
        Calls a push registration service to unregister a device to receive push notifications. This will also remove any stored PushRegistrationResponse on the device.
        Parameters:
        identifier - The device identifier
        callback - Callback that will deliver a Void or ErrorResponse
        Since:
        1.2.0.1