Firebase getting data not working on android 10 using react native

Viewed 1128

I was trying to fetch the data from firebase database, when i tried in system emulator its working fine and i am getting the data from the database. Emulator having the version Android N. But when i tested in real devices i am getting the data as undefined.

Please find the below code,

useEffect(() => {

   const subscriber = firestore()
      .collection('Users')
      //getting uid 
      .doc(uid)
      .onSnapshot(documentSnapshot => {
        console.log('User data: ', documentSnapshot.data());
      });

    // Stop listening for updates when no longer required
    return () => subscriber();
  }, [uid]);

below are the result when i run on android N emulator,

User data:  {"email": "****@gmail.com", "photo": "https://*****", "totalcount": 0, "user": "*"}

if i am running in real devices (Android 10) below is the result:

User data:  undefined

Updates

firebase database fetching not at all working on mobile devices. I have tried few queries and its showing below error:

 [firestore/unavailable] The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff.

its really affecting my users :(

Can anyone point the issue i was suffering from this issue for long time. A help will be really appreciable.

0 Answers
Related