使用APNS令牌而非FCM令牌的Firebase云功能消息传递 [英] Firebase Cloud Function Messaging with APNS Token rather than FCM Token

查看:147
本文介绍了使用APNS令牌而非FCM令牌的Firebase云功能消息传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置Firebase云功能,该功能将触发带有有效负载的云消息传递.但是,该函数收到的负载包含 Apple APNS令牌而不是FCM令牌,而且我在Firebase Admin SDK中看不到任何允许APNS令牌而不是FCM的方法.

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.

这是否意味着我必须编写自己的APNS Provider而不使用FCM?!

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

推荐答案

这是否意味着我必须编写自己的APNS Provider而不使用FCM?!

您可以这样做.我不知道这是多么令人震惊.为了使用 FCM ,您需要使用 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.

话虽如此,您也可以使用InstanceID Server API来创建具有APNs令牌的注册令牌:

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

为APNs令牌创建注册令牌

使用实例ID服务的batchImport方法,您可以将现有的iOS APN令牌批量导入到Google Cloud Messaging或Firebase Cloud Messaging,并将它们映射到有效的注册令牌.在此端点上调用实例ID服务,从而在JSON主体中提供APNs令牌列表:

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

响应主体包含一组实例ID注册令牌,这些令牌准备好用于将FCM或GCM消息发送到相应的APNs设备令牌.

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.

这篇关于使用APNS令牌而非FCM令牌的Firebase云功能消息传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆