Interface PushListener
Receives registration, message, and error events from a PushClient.
All methods run on the Codename One EDT. The listener is retained by the client and remains active until unregistration completes. It is installed before native registration starts, so a synchronous custom transport cannot outrun the listener.
Messages received before a client is active are replayed after
PushClient.register(). Operating systems may delay or suppress
background and silent delivery; an application should refresh authoritative
state when it resumes instead of treating push as a durable data channel.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when registration or envelope processing fails.voidonMessage(PushMessage message) Called for a parsed schema-3 message.voidonRegistration(PushSubscription subscription) Called when the native provider creates or rotates a subscription.
-
Method Details
-
onRegistration
Called when the native provider creates or rotates a subscription.
This method may run more than once during the life of an installation. Replace any previously stored token rather than assuming it is permanent.
- Parameters:
subscription- the current subscription
-
onMessage
Called for a parsed schema-3 message.
For a visible background notification, this normally runs when the user opens the notification. Foreground and silent delivery varies by platform and OS state.
- Parameters:
message- the immutable message envelope
-
onError
Called when registration or envelope processing fails.- Parameters:
error- a stable error code, diagnostic message, and retry hint
-