Giter Site home page Giter Site logo

Comments (6)

google-oss-bot avatar google-oss-bot commented on June 9, 2024

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

from firebase-android-sdk.

lehcar09 avatar lehcar09 commented on June 9, 2024

Hi @Kevinnad, thank you for reaching out. I tried reproducing the issue using our quickstart, however, I wasn't able to encounter the exception.

Here's how I implement it:

        databaseRef = Firebase.database
        val myRef = databaseRef.getReference("Devices")
        val isDeviceConnectedRef = myRef.child("myDevice").child("id")
        isDeviceConnectedRef.addValueEventListener(object : ValueEventListener {
            override fun onDataChange(dataSnapshot: DataSnapshot) {
                val newValue = dataSnapshot.getValue(String::class.java) ?: ""
                Log.d(TAG, "Value is: $newValue")
            }
            override fun onCancelled(error: DatabaseError) {
                // Failed to read value
                Log.w(TAG, "Failed to read value.", error.toException())
            }
        })

Did I misunderstood anything?

Can you share an MCVE or code snippet to help us investigate the issue? If you're unable to provide one, can you try our quickstart app and see if you can reproduce the issue?

Aside from that, are you constantly experiencing this error? or does the issue occur on certain devices and/or android versions?

from firebase-android-sdk.

google-oss-bot avatar google-oss-bot commented on June 9, 2024

Hey @Kevinnad. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

from firebase-android-sdk.

Kevinnad avatar Kevinnad commented on June 9, 2024

Hi @lehcar09 thanks for taking this issue

You first need to try with get, then same query with ValueEventListener, also try for multiple parallel request like the below snippet.

 val itemList = ArrayList<Object>()
        GlobalScope.launch {
            snapshots.map { snapshot ->
                return@map async(Dispatchers.Main) {
                        val dataSnapshot = databaseReferenceA().child(snapshot.key).get().await()
                        val result = dataSnapshot.getValue(Object::class.java)
                        return@async
                    } else {
                        return@async
                    }
                }
            }.awaitAll()

After the above code executed, call the below one of same DB reference

snapshots.map { snapshot ->
                        databaseReferenceA().child(snapshot.key).addValueEventListener(object : ValueEventListener {
            override fun onDataChange(dataSnapshot: DataSnapshot) {
                val newValue = dataSnapshot.getValue(String::class.java) ?: ""
                Log.d(TAG, "Value is: $newValue")
            }
            override fun onCancelled(error: DatabaseError) {
                // Failed to read value
                Log.w(TAG, "Failed to read value.", error.toException())
            }
        })
    }

from firebase-android-sdk.

lehcar09 avatar lehcar09 commented on June 9, 2024

I tried the code snippet you shared, however, I still wasn’t able to experience the issue. So far, it looks to me that there’s no issue on the SDK side.

I’m thinking if it’s possible that there are overlapping parallel calls happening at the same time that might be causing unwanted race conditions. Could you share an MCVE to further investigate the issue?

from firebase-android-sdk.

google-oss-bot avatar google-oss-bot commented on June 9, 2024

Hey @Kevinnad. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

from firebase-android-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.