Firebase messages.getToken() 失败并出现 MISSING_INSTANCEID_SERVICE 错误

问题描述 投票:0回答:2

我正在尝试将 Firebase Cloud Messaging 集成到正在进行的项目中。我按照安装指南here安装了@react-native-firebase/app和@react-native-firebase/messaging。 但是,当我尝试使用

await messaging.getToken()
获取设备令牌时,它失败并出现此警告 -NativeFirebaseError: [messaging/unknown] MISSING_INSTANCEID_SERVICE

请注意,如果我从 Firebase 控制台发送推送通知,它会在真实手机上发送,这表明问题可能不在于 FCM 设置。

任何有用的建议将不胜感激

firebase react-native firebase-cloud-messaging react-native-firebase android-devicetoken
2个回答
8
投票

模拟器你安装了google play吗??? 导致设备无法在没有 google play 的情况下生成令牌。 在geymotion中:要安装,请参阅https://stackoverflow.com/a/20137324/2234894


0
投票

如果您使用的是Huawei设备,您可能会遇到此错误。

© www.soinside.com 2019 - 2024. All rights reserved.