show display incoming call when receiving fcm push with inactive app state

Viewed 24

I have a react native app for call using call-keep, i successfully can receive notification when app is closed, i tried to display incoming call but it didn't worked, so some one told me before that inside of handler i must call setup, but it gave me error:'Activity doesn't exist related to this after some search found some change to work and it was this pull request: here it wasn't good because of handy change in node modules! so now after answering the call i still get that error and call keep disapears but it's backtoforground works and app woke up! what should i do to keep call-keep and wake up app?

messaging().setBackgroundMessageHandler(async (remoteMessage) => {
  RNCallKeep.setup({
    ios: {
      appName: "xxx",
    },
    android: {
      alertTitle:"newPhoneAccount",
      alertDescription: "newPhoneAccountDescription",
      cancelButton: "cancel",
      okButton: "ok",
    },
  });
  RNCallKeep.setAvailable(true);
   let callId = randomUuid().toUpperCase();
      //RNCallKeep.backToForeground();
      RNCallKeep.addEventListener("answerCall", ({ callUUID }) => {
        console.log("answerCall", callUUID);
        if ("android" === Platform.OS) {
          global["incomingCall"] = {
            callId: callUUID,
            callSession: remoteMessage,
          };
          RNCallKeep.setCurrentCallActive(callUUID);
          //RNUnlockDevice.unlock();
          RNCallKeep.backToForeground();
        }
      });

      RNCallKeep.addEventListener("endCall", (data) => {
        RNCallKeep.endAllCalls();
      });
      RNCallKeep.displayIncomingCall(
        callId,
        remoteMessage.number,
        remoteMessage.displayName,
        "number",
        false,
        {
          supportsDTMF: true,
          supportsHolding: true,
        }
      );

});
0 Answers
Related