Class PushClient.Builder

java.lang.Object
com.codename1.push.PushClient.Builder
Enclosing class:
PushClient

public static final class PushClient.Builder extends Object

Configures a PushClient.

A PushListener is required. Without a custom PushTransport, the client uses the platform transport and BuildCloud registration. Supplying a custom transport bypasses BuildCloud and also requires a PushRegistrationSink so the application can maintain its own server-side subscription.

  • Method Details

    • listener

      public PushClient.Builder listener(PushListener value)
      Sets the application listener.
      Parameters:
      value - the non-null listener retained for the life of the client
      Returns:
      this builder
    • registrationSink

      public PushClient.Builder registrationSink(PushRegistrationSink value)

      Mirrors subscription changes to application-owned code.

      For managed push this is optional and runs in addition to BuildCloud registration. For a custom transport it is required.

      Parameters:
      value - the registration sink, or null for managed push
      Returns:
      this builder
    • transport

      public PushClient.Builder transport(PushTransport value)

      Replaces the managed native transport.

      Setting this option prevents PushClient from contacting BuildCloud. The transport must emit schema-3 envelopes and the builder must also receive a registrationSink(PushRegistrationSink).

      Parameters:
      value - a custom native transport, or null to use managed platform push
      Returns:
      this builder
    • build

      public PushClient build()
      Creates the client.
      Returns:
      a client that must be retained and registered by the application
      Throws:
      IllegalStateException - if no listener is configured, or if a custom transport has no registration sink