react-native-callkeep
react-native-callkeep copied to clipboard
backToForeground not working on android 10 but 9 is fine
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:
-
[x] 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
It works for me in Android 11, and as stated does not work on Android 10. Any solution for this?
Android 10 11 12 same problem. When app killed, headless.js fired with slient notification but no call ui, app don't open.
Starting from Android 10, it seems ilke google has restricted opening app from background activity. It is recommended to use notification to replace it though.
Android 10 11 12 same problem. When app killed, headless.js fired with slient notification but no call ui, app don't open.
There is a solution. Follow that link
https://github.com/react-native-webrtc/react-native-callkeep/pull/576/commits/5e465fa776094091792d0bcd1c50f8dc70c9b217
That solution not in current released version. You must add own. That works for me in Android 10-11-12.
still not working on Android 11, RN callkeep v4.3.6 which already includes 5e465fa
still not working on Android 11, RN callkeep v4.3.6 which already includes 5e465fa
Same issue. Have you found solution yet? Thank you for responding.