FCM:尝试向 Expo 应用程序发送通知时发件人 ID 不匹配

FCM: Mismatched Sender Id when trying to send notification to Expo app

我有一个后端可以将 fcm 发送到网络应用程序和 expo 应用程序。仔细检查所有凭据。但仍然无法让它工作。这两个凭据都在同一个项目下。后端正在使用带有服务帐户的 firebase admin。前端正在使用 google-services.json。有人遇到过这个吗?

发现来自 expo-notification 的设备令牌只能用于独立构建。但在开发期间 expo-client 中没有。

https://forums.expo.io/t/using-fcm-as-push-notification-with-expo-client/42402/2?u=cyee

这是博览团队复制粘贴的评论。

Hi! If you want to send notifications directly through FCM, and not through the Expo notifications service, you’ll have to test in a standalone app (as in, an app you built with expo build:android). This is because you don’t have the push credentials for the Expo client app, only we do :slight_smile:

If you want to test in the Expo client app, then you can do that with Expo’s notifications, which you can read more about here- https://docs.expo.io/push-notifications/overview/