Class PushClient.Builder
java.lang.Object
com.codename1.push.PushClient.Builder
- Enclosing class:
PushClient
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 Summary
Modifier and TypeMethodDescriptionbuild()Creates the client.listener(PushListener value) Sets the application listener.Mirrors subscription changes to application-owned code.transport(PushTransport value) Replaces the managed native transport.
-
Method Details
-
listener
Sets the application listener.- Parameters:
value- the non-null listener retained for the life of the client- Returns:
- this builder
-
registrationSink
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, ornullfor managed push- Returns:
- this builder
-
transport
Replaces the managed native transport.
Setting this option prevents
PushClientfrom contacting BuildCloud. The transport must emit schema-3 envelopes and the builder must also receive aregistrationSink(PushRegistrationSink).- Parameters:
value- a custom native transport, ornullto use managed platform push- Returns:
- this builder
-
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
-