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

backToForeground not working on android 10 but 9 is fine

Open
#492 6 comments 4 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

  • On android 10 (huawei p30 pro), the call ui appears when the app is open, closed and the phone is closed but the app is not brought forward. Works (ui and app opening) on android 9 (lg v30).

  • Reproduced on:

  • Android

  • iOS

Description

The ui for the call works really well but the app is not brought forward on android like it does on android 9.

Steps to Reproduce

The console in the setBackgroundMessageHandler() and onMessage(0 appears in the console. For android 9 the backToForeground() clearly works.

// Watcher for incoming firebase messages when the app is closed
messaging().setBackgroundMessageHandler(async remoteMessage => {
  RNCallKeep.backToForeground();
  const getNewUuid = () => uuid.v4().toLowerCase();
  const callUUID = getNewUuid().toLowerCase();
  RNCallKeep.displayIncomingCall(callUUID, remoteMessage.data.name || "N/A", "Nita Waiting Room", 'generic', false);

  useIncommingFirebaseMessages(remoteMessage.data);
});

// Watcher for incoming firebase messages when the app is open
messaging().onMessage(async remoteMessage => {
  RNCallKeep.backToForeground();
  const getNewUuid = () => uuid.v4().toLowerCase();
  const callUUID = getNewUuid().toLowerCase();

  RNCallKeep.displayIncomingCall(callUUID, remoteMessage.data.name || "N/A", "Nita Waiting Room", 'generic', false);

  useIncommingFirebaseMessages(remoteMessage.data);
});
const useIncommingFirebaseMessages = (callData: any) => {
  const getNewUuid = () => uuid.v4().toLowerCase();
  const callUUID = getNewUuid();

  const answerCall = ({ callUUID }) => {
    hangup(callUUID)
    RootNavigation.navigate('CallPage', {
      callFromNotification: true
    });
  };

  // Click cancel incoming call
  const endCall = async ({ callUUID }) => {
    return false;

  };

  const hangup = (callUUID: any) => {
    RNCallKeep.endCall(callUUID);
    return true
  };

  RNCallKeep.addEventListener('answerCall', answerCall);
  RNCallKeep.addEventListener('endCall', endCall);

  return false
}

Versions

- Callkeep: 3.1.4
- React Native: 62.2
- iOS: -
- Android: 10 / 9
- Phone model: huawei p30 pro / lg v30

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 by reproducing the Android 10 case and tracing RNCallKeep.backToForeground() from setBackgroundMessageHandler and onMessage into the Android implementation. Done means the app is brought forward on Android 10 while preserving the incoming-call UI behavior described for Android 9.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.