Skip to content

VoipPushNotification.addEventListener('notification', () => {}); call twice #108

@w4ugit

Description

@w4ugit

I have the following code in app.js

useEffect(() => {
    if (Platform.OS === 'ios') {
      VoipPushNotification.addEventListener('register', token => {
        store.dispatch(setApnsToken(token));
      });

      VoipPushNotification.addEventListener('notification', notification => {
        Alert.alert('Call answer');
        const incomingCallAnswer = () => {
          store.dispatch(
            setCall({
              label: notification.aps.number,
              number: notification.aps.number,
              type: notification.aps.type,
              uuid: notification.aps.uuid,
              status: 'incoming',
            }),
          );
        };

        const endIncomingCall = () => {
          Incomingvideocall.endAllCall();
        };
        Incomingvideocall.configure(incomingCallAnswer, endIncomingCall);
        VoipPushNotification.onVoipNotificationCompleted(notification.uuid);
        return;
      });

      VoipPushNotification.registerVoipToken(); // --- register token
    }
  }, []);

when push comes i get two calls Alert.alert('Call answer');

What could be the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions