react-native-webrtc / react-native-webrtc/react-native-callkeep

displayIncomingCall ignored due to no ConnectionService or no phone account

Open
#621 8 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
511
Avg merge
9h 12m
Merged PRs (30d)
2

Description

Bug report

I've setup the call keep as mentioned in the documentation with selfManaged: true on android , and am looking at the debug logs (also mentioned in the documentation), but I'm getting the following error in the debug logs
displayIncomingCall ignored due to no ConnectionService or no phone account

  • I've checked the example to reproduce the issue.

  • Reproduced on:

  • Android

  • iOS

Description

I'm calling the stuff in a file called call.screen.tsx which calls the listeners as:

  useEffect(() => {
    const initCallKeep = async () => {
      try {
        const options: IOptions = {
          ios: {
            appName: 'My app name',
          },
          android: {
            alertTitle: 'Permissions required',
            alertDescription: 'This application needs to access your phone accounts',
            cancelButton: 'Cancel',
            okButton: 'ok',
            imageName: 'phone_account_icon',
            additionalPermissions: [],
            selfManaged: true,
            // Required to get audio in background when using Android 11
            foregroundService: {
              channelId: 'com.company.my',
              channelName: 'Foreground service for my app',
              notificationTitle: 'My app is running on background',
              notificationIcon: 'Path to the resource icon of the notification',
            },
          },
        };

        RNCallKeep.setAvailable(true);
        await RNCallKeep.setup(options);
      } catch (e) {
        console.error('Error occured while initializing callkeep: ', e);
        showError(e);
      }
    };

    initCallKeep();
  }, []);

  const actionHandler = (action: string) => {
    console.log('Called handler for action: ', action);
  };

  useEffect(() => {
    Api.on(ApiEvent.IncomingCall, onIncomingCall);
    Api.on(ApiEvent.CallUpdate, onCallUpdated);

    RNCallKeep.addEventListener('showIncomingCallUi', showCallUI);
    RNCallKeep.addEventListener('didReceiveStartCallAction', () => actionHandler('didReceiveStartCallAction'));
    RNCallKeep.addEventListener('answerCall', () => actionHandler('answerCall'));
    RNCallKeep.addEventListener('endCall', () => actionHandler('endCall'));
    RNCallKeep.addEventListener('didDisplayIncomingCall', () => actionHandler('didDisplayIncomingCall'));
    RNCallKeep.addEventListener('didPerformSetMutedCallAction', () => actionHandler('didPerformSetMutedCallAction'));
    RNCallKeep.addEventListener('didPerformDTMFAction', () => actionHandler('didPerformDTMFAction'));

    return () => {
      Api.off(ApiEvent.IncomingCall, onIncomingCall);
      Api.off(ApiEvent.CallUpdate, onCallUpdated);

      RNCallKeep.removeEventListener('showIncomingCallUi');
      RNCallKeep.removeEventListener('didReceiveStartCallAction');
      RNCallKeep.removeEventListener('answerCall');
      RNCallKeep.removeEventListener('endCall');
      RNCallKeep.removeEventListener('didDisplayIncomingCall');
      RNCallKeep.removeEventListener('didPerformSetMutedCallAction');
      RNCallKeep.removeEventListener('didPerformDTMFAction');
    };
  }, []);

  const onIncomingCall = useCallback(
    async (data: ICall) => {
      try {
        if (isCalling) {
          throw 'Call Event Duplication: A call was already in progress while another incoming call event was received';
        }

        setBookingID(data.bookingId);
        setCallID(data.id);
        RNCallKeep.displayIncomingCall(data.id, 'Driver');
      } catch (e) {
        console.error('Failed to start the call: ', e);
        throw e;
      }
    },
    [isCalling],
  );

  const showCallUI = () => {
    setIsCalling(true);
    setStatus(CallStatus.Incoming);
    CallService.playRingTone();
  };

Steps to Reproduce

Versions

- Callkeep: ^4.3.3
- React Native: 0.69.5
- iOS: NA
- Android: 10
- Phone model: Xiaomi Redmi 8

Logs

11-02 16:40:09.765 24283 26727 D RNCallKeep: [VoiceConnectionService] setAvailable: true
11-02 16:40:09.765 24283 26727 D RNCallKeep: [VoiceConnectionService] setInitialized: true
11-02 16:40:09.770 24283 26727 D RNCallKeep: [RNCallKeepModule] setup
11-02 16:40:09.770 24283 26727 D RNCallKeep: [VoiceConnectionService] setAvailable: false
11-02 16:40:09.770 24283 26727 D RNCallKeep: [VoiceConnectionService] setInitialized: true
11-02 16:40:09.770 24283 26727 D RNCallKeep: [RNCallKeepModule] setSettings: { NativeMap: {"alertTitle":"Permissions required","foregroundService":{"channelId":"com.company.my","channelName":"Foreground service for my app","notificationTitle":"My app is running on background","notificationIcon":"Path to the resource icon of the notification"},"alertDescription":"This application needs to access your phone accounts","cancelButton":"Cancel","imageName":"phone_account_icon","okButton":"ok","selfManaged":true,"additionalPermissions":[]} }
11-02 16:40:09.772 24283 26727 D RNCallKeep: [RNCallKeepModule] API Version supports self managed, and is enabled in setup
11-02 16:40:09.772 24283 26727 D RNCallKeep: [RNCallKeepModule] setup, adding RECORD_AUDIO in permissions in self managed
11-02 16:40:09.772 24283 26727 D RNCallKeep: [RNCallKeepModule] registerPhoneAccount
11-02 16:40:09.840 24283 26727 D RNCallKeep: [RNCallKeepModule] registerEvents
11-02 16:40:09.840 24283 26727 D RNCallKeep: [RNCallKeepModule] startObserving, event count: 0
11-02 16:40:09.840 24283 26727 D RNCallKeep: [RNCallKeepModule] startObserving, event count: 0
11-02 16:40:09.840 24283 26727 D RNCallKeep: [VoiceConnectionService] setAvailable: true
11-02 16:40:09.840 24283 26727 D RNCallKeep: [VoiceConnectionService] setInitialized: true
11-02 16:40:43.990 24283 26727 W RNCallKeep: [RNCallKeepModule] displayIncomingCall ignored due to no ConnectionService or no phone account

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with call.screen.tsx and trace RNCallKeep.setup, setAvailable, and displayIncomingCall against the warning in the Android logs. Inspect how the setup registers the ConnectionService and phone account for selfManaged mode. Done means the reported Android configuration can display the incoming call without the no ConnectionService or phone account warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.