android - 弹出的 React Native 应用程序无法到达 Firestore 后端

标签 android firebase google-cloud-firestore react-native

我在使用expo的react-native应用程序中通过Firebase Javascript SDK使用Firestore,但从expo弹出后,即使我的设备已连接到互联网,我也会收到此错误:

@firebase/firestore: Firestore (7.19.1): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

我该如何解决这个问题,或者我应该使用react-native-firebase包?

最佳答案

我可以通过在 firebase config.js 底部添加此行来解决此问题:

export const firebase = Firebase.initializeApp(firebaseConfig);
firebase.firestore().settings({experimentalForceLongPolling: true}); // add this

现在 firestore 按我的预期工作了

关于android - 弹出的 React Native 应用程序无法到达 Firestore 后端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63766786/

相关文章:

java - OnCreate 强制 Activity 崩溃 : ImageButton ClassCastException

android - 在 Firebase 上使用事务

express - Firebase Nodejs函数设置cookie TypeError : option sameSite is invalid

javascript - 属性 <Object> 包含无效的嵌套实体。/Firebase

android - p7zip on Android - 在 Android 上提取 7z 存档

android - 相机预览 onPictureTaken 在 android 中返回错误数据

php - 电话可以用来传播本地主机的使用吗?

firebase - Flutter + Firestore:过滤器列表

c# - 我如何将 firestore 时间戳转换为不同的格式 en c#

javascript - Firebase错误: [code=resource-exhausted]: Write stream exhausted maximum allowed queued writes