Push and application lifecycle
Bind provider-neutral push sources and coordinate foreground, background, logout, and disposal safely.
Your host owns the provider
The Flutter package is provider-neutral. Your app owns permission prompts, Firebase/APNs configuration, token discovery, background handlers, and notification presentation. Adapt those callbacks into V Chat instead of exposing provider objects to the core client.
Attach a push binding
final binding = VChatPushIntegrationBinding(
push: sdk.client.push,
installationId: stableInstallationId,
tokenSource: hostTokenSource,
notificationSource: hostNotificationSource,
onRoute: handleAcceptedVChatRoute,
onDiagnostic: recordSafePushDiagnostic,
);
await binding.attach();
// Before the authenticated user is logged out:
await binding.revokeBeforeLogout();
await binding.disposeAsync();The binding serializes token updates, routes only the released content-light payload, and deduplicates through scoped durable receipt IDs.
Foreground and background
- Backgrounding may suspend ticketing, connecting, recovering, connected, or reconnecting work.
- Foreground resume starts only when a lifecycle was actually suspended.
- A suspension that wins before ready returns request_cancelled rather than a fabricated protocol error.
- Logout revokes device registration, disconnects realtime, and disposes the scoped SDK before account state changes.