Initialize the SDK
When using JavaScript-controlled initialization, call initialize() before registering listeners or requesting push notifications:
import Reteno from 'expo-reteno-sdk';
await Reteno.initialize('YOUR_SDK_ACCESS_KEY');Skip this call if sdkAccessToken is set in the platform plugin config, because that enables automatic initialization.
Register for Push Notifications
Call registerForRemoteNotifications() once at app startup:
import { useEffect } from 'react';
import Reteno from 'expo-reteno-sdk';
useEffect(() => {
Reteno.registerForRemoteNotifications();
}, []);Get Initial Notification
When your app is opened by clicking a push notification, you can read its payload with getInitialNotification.
import { useEffect } from 'react';
import { Alert } from 'react-native';
import Reteno from 'expo-reteno-sdk';
useEffect(() => {
Reteno.getInitialNotification().then((data) => {
Alert.alert('getInitialNotification', data ? JSON.stringify(data) : 'null');
});
}, []);Set device token manually
Use setDeviceToken() when managing the iOS FCM/APNs token manually:
const result = await Reteno.setDeviceToken(token);The method returns Promise<boolean>. On Android it resolves successfully without changing the token because token handling is performed by the native Firebase messaging service.
Listen for New Push Notifications while App Is Active
To listen to pushes in foreground, use setOnRetenoPushReceivedListener:
import { useEffect } from 'react';
import { Alert } from 'react-native';
import Reteno from 'expo-reteno-sdk';
useEffect(() => {
const pushListener = Reteno.setOnRetenoPushReceivedListener((event) => {
Alert.alert('onRetenoPushReceived', event ? JSON.stringify(event) : 'null');
});
return () => pushListener.remove();
}, []);Listen for Push Notification Clicks
To handle notification clicks, use setOnRetenoPushClickedListener:
import { useEffect } from 'react';
import { Alert } from 'react-native';
import Reteno from 'expo-reteno-sdk';
useEffect(() => {
const pushClickListener = Reteno.setOnRetenoPushClickedListener((event) => {
Alert.alert('onRetenoPushClicked', event ? JSON.stringify(event) : 'null');
});
return () => pushClickListener.remove();
}, []);iOS Action Buttons
For iOS push action buttons, use setOnRetenoPushButtonClickedListener:
import { useEffect } from 'react';
import { Platform } from 'react-native';
import Reteno from 'expo-reteno-sdk';
useEffect(() => {
if (Platform.OS !== 'ios') return;
const listener = Reteno.setOnRetenoPushButtonClickedListener((event) => {
console.log('onRetenoPushButtonClicked', event);
});
return () => listener.remove();
}, []);Auto-open Links Behavior
Use these methods to control whether SDK opens links from push/in-app automatically:
import Reteno from 'expo-reteno-sdk';
await Reteno.setAutoOpenLinks(true); // enable
const isEnabled = await Reteno.getAutoOpenLinks();
console.log('Auto-open links:', isEnabled);Default value:
- iOS:
true - Android:
false
Important for Expo
expo-reteno-sdkrequires a development build or bare app.- Expo Go is not supported for push features using native module integration.