Push Notifications

Push notifications require native registration to obtain a device token, then forwarding events to Lucra.

iOS

Register for remote notifications using your preferred library and pass the device token to Lucra.

Register Device Token

import {
  registerDeviceTokenHex,
  registerDeviceTokenBase64,
} from '@lucra-sports/lucra-react-native-sdk';
import PushNotificationIOS from '@react-native-community/push-notification-ios';

PushNotificationIOS.addEventListener('register', async (token) => {
  await registerDeviceTokenHex(token);
});

// If your provider returns base64 tokens, use:
// await registerDeviceTokenBase64(token);

PushNotificationIOS.requestPermissions();

Handling Incoming Notifications

When the user taps a push notification, forward its payload to Lucra:

Android

Android requires native setup to capture the device token and route notifications into Lucra.

Follow the native Android instructions: https://github.com/Lucra-Sports/lucra-android-sdk/blob/develop/docs/1.2.3_push_notifications.md

Last updated