i'm using callkeep and react native with firebase, i want to show incoming call or wake app up when receiving incoming push from fcm when app is closed(quieet state). so i already tried to show incoming call or backToForeground, but it not works for my device with android 11 in headless mode?
messaging().setBackgroundMessageHandler(async (remoteMessage) => {
//1
RNCallKeep.backToForeground();
//2
RNCallKeep.displayIncomingCall(
callId,
"123",
"shb",
"number",
false,
{
supportsDTMF: true,
supportsHolding: true,
}
);
}
AppRegistry.registerComponent(appName, () => App);
the setup of call keep happens when getting permission in some sliding/next senario
In the case of android you must configure the permissions to be able to show the call window, you can do it in the following way.
const options = {
android: {
alertTitle: 'Permissions Required',
alertDescription: 'This application needs to access your phone calling accounts to make calls',
cancelButton: 'Cancel',
okButton: 'ok',
},
};
RNCallKeep.setup(options);
Also in the displayIncomingCall you can use this configuration, it is the one that works for me currently.
RNCallKeep.displayIncomingCall(callUuid, callerNumber, callerName, 'number', true);
You should also use silent notifications, in case you need help, here is the documentation, it is important that you define the priority of the notification so that it can arrive in the background & quit.