Handle missed events with didLoadWithEvents
masterSince VoIP pushes are time-sensitive, they may arrive while the React Native JavaScript bridge is still initializing. The didLoadWithEvents event provides a way to catch these missed events.
When this event fires, it returns an array of event objects. Each object contains a name and data. You should check the name against the following constants to process them correctly:
VoipPushNotification.RNVoipPushRemoteNotificationsRegisteredEventVoipPushNotification.RNVoipPushRemoteNotificationReceivedEvent
VoipPushNotification.addEventListener('didLoadWithEvents', (events) => {
if (!events || !Array.isArray(events) || events.length < 1) {
return;
}
for (let voipPushEvent of events) {
let { name, data } = voipPushEvent;
if (name === VoipPushNotification.RNVoipPushRemoteNotificationsRegisteredEvent) {
// Manually trigger your registration logic with 'data'
} else if (name === VoipPushNotification.RNVoipPushRemoteNotificationReceivedEvent) {
// Manually trigger your notification logic with 'data'
}
}
});