Android 上的世博会推送通知
Expo Push Notifications on Android
我在 Expo Go 应用程序和 iOS 版本中使用了 Expo Push Notifications。但是,它在 Android 上不起作用,我在 运行 getExpoPushTokenAsync():
时收到此消息
Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google.
我已按照 documentation 中列出的所有步骤进行操作:app.json 中引用了我的 google-services.json 并且我仔细检查了那里的所有信息,包括项目 ID。
我尝试通过 getDevicePushTokenAsync() 获取本机设备令牌并且它有效,但是即使我想在没有 Expo 的情况下使用 firebase 通知,我在尝试设置 firebase 通知侦听器时进一步得到相同的错误。
问题可能与以下事实有关:当我调用 getExpoPushTokenAsync() 时,Firebase 应用程序已经 运行 JS SDK(用于 realtimeDB 和存储)使用其他配置,我也许可以初始化辅助 Firebase具有 google-services.json 配置的应用程序(有效,我试过了)但我看不到任何强制 Expo Notifications 使用此应用程序的方法。
知道发生了什么事吗?
谢谢!
所以我解决了这个问题,如果有人仍然需要答案:
我正在通过 Expo over-the-air 更新使用 google-services.json 文件更新我的应用程序,但我需要在 Goole Play 控制台上提交一个全新的版本并通过再次整个验证过程,以便将文件考虑在内。现在他们使用完全相同的代码部署了我的新版本并且它可以工作。
我在 Expo Go 应用程序和 iOS 版本中使用了 Expo Push Notifications。但是,它在 Android 上不起作用,我在 运行 getExpoPushTokenAsync():
时收到此消息Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google.
我已按照 documentation 中列出的所有步骤进行操作:app.json 中引用了我的 google-services.json 并且我仔细检查了那里的所有信息,包括项目 ID。
我尝试通过 getDevicePushTokenAsync() 获取本机设备令牌并且它有效,但是即使我想在没有 Expo 的情况下使用 firebase 通知,我在尝试设置 firebase 通知侦听器时进一步得到相同的错误。
问题可能与以下事实有关:当我调用 getExpoPushTokenAsync() 时,Firebase 应用程序已经 运行 JS SDK(用于 realtimeDB 和存储)使用其他配置,我也许可以初始化辅助 Firebase具有 google-services.json 配置的应用程序(有效,我试过了)但我看不到任何强制 Expo Notifications 使用此应用程序的方法。
知道发生了什么事吗? 谢谢!
所以我解决了这个问题,如果有人仍然需要答案:
我正在通过 Expo over-the-air 更新使用 google-services.json 文件更新我的应用程序,但我需要在 Goole Play 控制台上提交一个全新的版本并通过再次整个验证过程,以便将文件考虑在内。现在他们使用完全相同的代码部署了我的新版本并且它可以工作。