setClickHandler method
Set a handler for taps on a Live Activity
The handler receives the deep link carried by the tapped element and the
index of the tapped action button (-1 for the notification body).
A tap that launched the app is replayed to the handler as soon as it is
registered, so registering it late — for example after initialize() —
does not lose a cold-start click.
On Android, whether the SDK already opened the link follows the
handleNotificationLink flag passed to PushpushgoSdk.initialize(). On
iOS the flag does not apply; see LIVE_ACTIVITIES.md.
Example:
PPGLiveActivities.instance.setClickHandler((click) {
if (click.deepLink != null) {
Navigator.of(context).pushNamed(click.deepLink!);
}
});
Implementation
void setClickHandler(LiveActivityClickHandler handler) {
_clickHandler = handler;
_setupEventListening();
if (_pendingClicks.isEmpty) return;
final buffered = List<LiveActivityClick>.of(_pendingClicks);
_pendingClicks.clear();
for (final click in buffered) {
handler(click);
}
}