You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an expo app where the user connects the phone to a network with no internet connection.
After a few seconds, the device restores its internet connection by connecting to a different WiFi network. As soon as the connection is restored (NetInfo isconnected), the app tries to get some data from the firebase (get or onValue) but it does not look like the "onValue" or "get" ever fires/kicks in.
I tested the same behavior (disconnect/reconnect) with IOS and it works flawlessly.
In Android if the phone never loses internet connection the method below works as expected (tells me that database rules and setup is good).
In Android if I turn off the WiFi and get the app execute below method, I see modal content changing to "verify connectivity" but never changes to "verification failed" or "success"
I tried it on both development and production... same problem.
I wrapped it with try/catch but it never showed an error.
I tried to run it with the callback on error but never showed on error.
I tried it with datasnapshot.exists(), async/sync, with await, useeffect but none of them helped.
What else I could try?
import { getDatabase, ref, onValue, set, get } from "firebase/database";
const db = getDatabase();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello everyone,
I have an expo app where the user connects the phone to a network with no internet connection.
After a few seconds, the device restores its internet connection by connecting to a different WiFi network. As soon as the connection is restored (NetInfo isconnected), the app tries to get some data from the firebase (get or onValue) but it does not look like the "onValue" or "get" ever fires/kicks in.
I tested the same behavior (disconnect/reconnect) with IOS and it works flawlessly.
In Android if the phone never loses internet connection the method below works as expected (tells me that database rules and setup is good).
In Android if I turn off the WiFi and get the app execute below method, I see modal content changing to "verify connectivity" but never changes to "verification failed" or "success"
I tried it on both development and production... same problem.
I wrapped it with try/catch but it never showed an error.
I tried to run it with the callback on error but never showed on error.
I tried it with datasnapshot.exists(), async/sync, with await, useeffect but none of them helped.
What else I could try?
import { getDatabase, ref, onValue, set, get } from "firebase/database";
const db = getDatabase();
const verifyConnectivity = async () => {
setmodalContent("verifying connectivity");
const FSRef = ref(db, "faz/" + "abcde01");
console.log(FSRef);
onValue(FSRef, (datasnapshot) => {
if (datasnapshot.val() === true) {
setmodalContent("verification success" );
} else {
setmodalContent("verification failed");
}
});
};
Beta Was this translation helpful? Give feedback.
All reactions