skip to Main Content

Flutter Incoming Callkit notifications are working fine on my iOS app in all states (foreground/background/terminated).

On iOS device, issue is when my app is in background or terminated state and if I open any other app after closing or minimizing my application , I stop getting callKit notification in both background/terminated state.

I don’t know that which part can cause this issue i.e if its from my code or its the problem in iOS device itself. Because besides opening another app after closing/minimizing my app, I am getting call notifications in all states of my app.

[Note: Everything is working fine in the Android app]

This is the silent notification being received to the receiver from cloud function.

  await admin.messaging().send({
    token: token_o,
    notification: {
    },
    data: {
      imageUrl: requesterImageUrl,
      chatRoomId: chatRoomId,
      screenName: 'voiceScreen',
      voiceCall: 'voiceCall',
      callerName: requesterName,
      callsDocId: callsDocId,
      senderId: requesterId,
    },
    android: {
        notification: {
            click_action: "android.intent.action.MAIN"
        },
    },
     apns: {
              headers: {
                apns_priority: "10",
              },
              payload: {
                aps: {
                  badge: 1
                },
                notification: {
                title: "iOVoiceCallNotification",
                body: {},
                                  },
                mutable_content: true,
                content_available : true,

              }
            }
  }).then(value => {
    functions.logger.log("Notification for AudioCall is sent to the Receiver");
  }).catch((e) => {
    functions.logger.log(e.toString());
  });

I can provide anyother code or log if required.

2

Answers


  1. Chosen as BEST ANSWER

    I simply had to configure pushKit to awake iOS from background & terminated state.

    Note: Even for pushKit, I had to create a token for iOS device from the getVoipToken() function that is present in flutter_call_kit incoming package.


  2. Inorder to recieve callKit notifications perfectly in background/terminated states in IOS you have to do following necessary things:

    1. Implement APNs (Apple push notifications) for IOS. Because IOS devices will not wake the phone and show call when you send firebase notifications in background/terminated states. IOS devices require APNs to achieve this.
    2. Follow the instructions written in PUSHKIT.md if you are using flutter_callkit_incoming package for flutter app.
    3. Configure your backend (from where you want to recieve notifications) to send both firebase and APN notifications depends upon the device user is using. (I recommend you to send the platform e.g "android" or "ios" along with the device token to your backend when you register the firebase token in flutter app. You can also ask for IOS deviceToken from firebase.

    I know its very lengthy process but it is. I was also very disappointed when I was required to integrate call notifications in my app and I have to do all this on my frontend app and backend.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search