I have an issue with the call notification not working in the background in release mode, but it works in debugging mode on iOS.
I am using CallKit with FCM (Firebase Cloud Messaging) for notifications. When I receive a notification from Firebase, I call a function to activate the CallKit dialog in the background. This works in debugging mode but not in TestFlight or release mode on iOS.
Can you help me fix this issue, please? Below is my code for handling incoming calls:
@pragma("vm:entry-point")
Future<void> myBackgroundMessageHandler(RemoteMessage message) async {
debugPrint('Handling a background message');
// Handle the message here
if (message.notification == null) {
if (message.data['status'] == "groupCall") {
String roomName = message.data['groupId'];
showCallkitIncoming(roomName, message.data);
readyForReceiveCalls = false;
} else if (message.data['status'] == "calling") {
String roomName = Controller().sortUserIds(message.data['calleeId'], message.data['callerId']);
showCallkitIncoming(roomName, message.data);
readyForReceiveCalls = false;
} else if (message.data['status'] == "callCancelled") {
FlutterCallkitIncoming.endAllCalls();
readyForReceiveCalls = true;
currentUuid = null;
}
}
}
Notes: redirect the user to a webpage when they accept the call. I'm certain that the app receives notifications when in the background, but the CallKit notification doesn't work in release mode.
I've added the following permissions to my .plist file: `
<array>
<string>fetch</string>
<string>remote-notification</string>
<string>voip</string>
</array>
Do I need any other permissions, or is there something missing in my implementation? Regarding the
<string>voip</string>
Is it required in my case, even though I'm not using any VoIP features since I create the calls in webpages?