Firebase Cloud Function Messaging with APNS Token rather than FCM Token

泪湿孤枕 提交于 2020-06-23 11:48:27

问题


I am trying to setup a Firebase Cloud Function that will trigger a Cloud Messaging with Payload. The received load by the function however contains Apple APNS Tokens rather than FCM Tokens and I don't see any methods in Firebase Admin SDK allowing APNS Token rather than FCM.

Does that mean that I have to write my own APNS Provider and not use FCM?!


回答1:


Does that mean that I have to write my own APNS Provider and not use FCM?!

You could do that. I don't see how this is a shock. In order to use FCM, you need to use FCM tokens. It's just how a service works.

With all that said, you could also use the InstanceID Server API to create registration tokens with the APNs tokens:

Create registration tokens for APNs tokens

Using the Instance ID service's batchImport method, you can bulk import existing iOS APNs tokens to Google Cloud Messaging or Firebase Cloud Messaging, mapping them to valid registration tokens. Call the Instance ID service at this endpoint, providing a list of APNs tokens in the JSON body:

 https://iid.googleapis.com/iid/v1:batchImport

The response body contains an array of Instance ID registration tokens ready to be used for sending FCM or GCM messages to the corresponding APNs device token.



来源:https://stackoverflow.com/questions/50344633/firebase-cloud-function-messaging-with-apns-token-rather-than-fcm-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!