Writing in 2022
TL;DR
No, it is not possible at the moment.
Why?
Theoretically, as per apple apns request specifications, it seems like all we need to specify the following in the headers:
apns-push-type: "voip",
apns-topic: "<app-bundle-id>.voip"
and this will send a voip notification via PushKit (of course we have to enable PushKit and Background notification capabilities)
Setting these headers in FCM message can be set possible as per FCM docs like:
{
"message": {
"token": "fcm-token",
"apns": {
"headers": {
"apns-push-type": "voip",
"apns-topic": "<app-bundle-id>.voip"
},
"payload": {
"aps": {
"contentAvailable": 1
},
"customKey": "customValue"
}
}
}
}
Here FCM sends the message.apns.payload
object as it is to the APNs server along with the headers
.
But:
Problem comes with certificate and key. Apple does not allow a single key or certificate to have both APNs and VoIP permission scopes and FCM does not allow multiple keys or certificates to be uploaded for the same project.
So, FCM can be used (theoretically) with PushKit but not with APNs at the same time. Although Apple specifies that PushKit uses APNs underneath, but it uses different authentication.
We can either create two different project (very difficult to manage) or use other services for PushKit. I am using serverless architecture but APNs server is not serverless friendly as it needs a persistent connection to be maintained.